CRACO, worker-plugin, and, react-refresh-webpack-plugin
See original GitHub issueI’ll start by being honest - I’m not sure which repo this issue truly belongs to but I’ll start here.
I use CRACO to achieve a few things, including enabling web workers.
This is my config prior to react-scripts 4. Worked great
const { whenProd, addBeforeLoader, loaderByName } = require("@craco/craco");
const WorkerPlugin = require('worker-plugin');
module.exports = {
webpack: {
configure: function(webpackConfig) {
// some stuff
return webpackConfig;
},
plugins: [
new WorkerPlugin(),
],
},
};
Since updating everything, I’ve encountered some issues.
The config I’ve attempted (and some variations on)
const { whenProd, addBeforeLoader, loaderByName } = require("@craco/craco");
const WorkerPlugin = require('worker-plugin');
module.exports = {
webpack: {
configure: function(webpackConfig) {
// some stuff
return webpackConfig;
},
plugins: [
new WorkerPlugin({
globalObject: 'this',
plugins: [
'react-refresh-webpack-plugin'
]
}),
],
},
};
So this error is obviously to do with react-refresh-webpack-plugin
and I’ve tried to work out how to trick it into doing the right thing but no luck.
I found https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/24 but couldn’t get anything from it to work
What should I do?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
using-craco-workers - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >craco-worker-loader - npm
Craco plugin for worker-loader. Latest version: 1.0.0, last published: 3 years ago. Start using craco-worker-loader in your project by ...
Read more >How to use the customize-cra.addWebpackPlugin function in ...
To help you get started, we've selected a few customize-cra.addWebpackPlugin examples, based on popular ways it is used in public projects.
Read more >How can I add support for web workers in a CRACO Webpack ...
Inside craco.config.js I add the plugin to my webpack object ... The larger portion of the library WorkerPlugin.prototype.apply does not ...
Read more >React-refresh-webpack-plugin - npm.io
Check React-refresh-webpack-plugin 0.1.0 package - Last release 0.1.0 with MIT licence at our NPM packages aggregator and search engine.
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
@justrealmilk the following code snippet works with react-scripts@4.0.3
Can you elaborate on your solution please? I’ve been following the guide at https://blog.johnnyreilly.com/2020/02/21/web-workers-comlink-typescript-and-react, however when my client tries to call the URL where the web worker’s file is supposed to live, there’s nothing there…