Skip to content

Uncaught SyntaxError: Unexpected token < #18

Open
@mmwo

Description

@mmwo

I wanted to create an npm package that internally uses web worker. I got working configuration for that in the worker-loader package for webpack as follows.

{
  test: /\.worker\.js$/,
  use: {
    loader: 'worker-loader',
    options: {
      inline: true
    }
  }
}

then I could use my library in some react project like that

import {BoardGenerator} from '@yufuzu/shipbattle-board';
const generator = new BoardGenerator();

Board generator is my npm library that uses it's web worker.

When I switched to this plugin I get an error that it cannot find web worker. Everything compiles properly and I am able to see use it in live mode in the browser. (From this project npm start). Problem occurs only when I import that library in some other project.

Repo:
https://github.com/Jitra/shipbattle-generatorv2 working in here npm start
React repo importing npm package:
https://github.com/Jitra/react-shipbattle-generator-example not working here

Old version with worker-loader
https://github.com/Jitra/shipbattle-generator

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requestedwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions