Uncaught TypeError: Failed to construct 'Worker'
See original GitHub issueI tried minimum example. (on Chrome 69/Mac)
// src/index.js
const worker = new Worker("./worker.js", { type: "module" });
worker.onmessage = event => {
console.log("response: " + event.data);
};
worker.postMessage(0);
// webpack.config.js
const HTMLPlugin = require("html-webpack-plugin");
const WorkerPlugin = require("worker-plugin");
module.exports = {
mode: process.env.NODE_ENV || "development",
plugins: [new HTMLPlugin(), new WorkerPlugin()]
};
Compile success but I got this error on browser.
Uncaught TypeError: Failed to construct 'Worker': Module scripts are not supported on DedicatedWorker yet. You can try the feature with '--enable-experimental-web-platform-features' flag (see https://crbug.com/680046)
at Object.<anonymous> (main.js:9346)
at Object../src/index.js (main.js:9354)
at __webpack_require__ (main.js:20)
at Object.0 (main.js:9366)
at __webpack_require__ (main.js:20)
at ./node_modules/ansi-html/index.js.module.exports (main.js:84)
at main.js:87
Build result is here
/* WEBPACK VAR INJECTION */(function(__webpack__worker__1) {const worker = new Worker(__webpack__worker__1, { type: "module" });
// ...
I tried enable-experimental-web-platform-features
but it does not work too. (and ChromeCanary too)
I think, it is lack of some pre-conditions.
My full code is here https://github.com/mizchi-sandbox/try-worker-plugin
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:6
Top Results From Across the Web
Uncaught DOMException: Failed to construct 'Worker': Script ...
If you are seeing this in Chrome then the answer probably has to do with loading from a local filesystem rather than over...
Read more >Failed to construct 'Worker': Script at ... cannot be accessed ...
Hello, my web-worker doesn't load in production when use different servers for app and assets 16.8e953915c614.js:1 Uncaught DOMException: ...
Read more >Unable to create memory game – JS errors - WordPress.org
Uncaught TypeError : Cannot read property 'makeTabbable' of undefined at ... Uncaught DOMException: Failed to construct 'Worker': Access to the script at ...
Read more >Failed to construct 'Worker': Access to the script at 'blob ...
Hi, I am getting an error while importing meshes while host the project in a particular server. I am not getting this in...
Read more >Getting Failed to construct 'Worker' with JS worker file located ...
How to resolve "Uncaught TypeError: Failed to construct 'Comment': Please use the 'new' operat....." with respect to React JS? ... How can i...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be fixed by https://github.com/GoogleChromeLabs/worker-plugin/commit/9178a29a2a91ffe8c2dc1bf192117f0ed334a0a7 😃
Fix released in 1.1.0!