Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tries to load module object instead of name #4

Closed
TimvdLippe opened this issue Sep 20, 2018 · 3 comments
Closed

Tries to load module object instead of name #4

TimvdLippe opened this issue Sep 20, 2018 · 3 comments

Comments

@TimvdLippe
Copy link
Contributor

I have the following in my main-thread.js:

const worker = new Worker('./counter-worker.js', {type: 'module'});

With an empty counter-worker.js. When I open the build, it loads http://localhost:8000/build/[object%20Module] rather than http://localhost:8000/build/0.main-thread.worker.js It appears that the following diff in the build output makes it work again:

- const worker = new Worker(__webpack__worker__1, {type: 'module'});
+ const worker = new Worker(__webpack__worker__1.default, {type: 'module'});

As the console output of __webpack__worker__1 is the following:

> Module {default: "0.main-thread.worker.js", __esModule: true, Symbol(Symbol.toStringTag): "Module"}
default: "0.main-thread.worker.js"
Symbol(Symbol.toStringTag): "Module"
__esModule: true
__proto__: Object

That appears to be the result of __webpack_require__(1), which returns the module object. However, I can't find any reference to the Module object in that module.

This happens on both Chrome 69 and Firefox 62.

@developit
Copy link
Collaborator

Ah - this would also vary depending on whether your Webpack configuration is set up to transpile all .js files as well. #5 should fix.

developit added a commit that referenced this issue Oct 8, 2018
@developit
Copy link
Collaborator

Fix released in 1.1.0 :)

@TimvdLippe
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants