Comments (5)
Getting this as well.
Attached a debugger to investigate.
The problem is the loader is not hitting the parser anymore - because there's nothing to parse thanks to the cache; and thus the export declaration hook that is meant to collect exported methods is no longer run.
However, as the output of the loader is marked non-cachable, that part actually will rebuild every time. And ofcourse, after the first build it gets an empty array of collected methods.
The solution here is, I think, to use the Webpack cache to cache the array of exported methods along with the modules. or to somehow mark the entry module of the worker as non-cacheable which forces it to always be processed from source, and always have the parser run.
[EDIT]
Actually: it's even easier than that.
There is no reason to manually bookkeep the exports with the parser hook at all.
Technically, under the assumption that users will only export methods from the entry module of the worker, the only thing you need is:
const exportNames = compilation.moduleGraph.getProvidedExports(entryModule);
from workerize-loader.
Bypassed this issue by using webpack / Workers directly without this loader and RPC implementation. Feel free to investigate further or close this issue if you don't plan to have support for Gatsby out of the box 👍🏻
from workerize-loader.
Running into the same issue with a recent version of create react app (v. 5.0.1). Had to disable the webpack cache as a workaround. Would be great if this could be taken care of on the library side
from workerize-loader.
yes same situation, when I cancel 的 webpack cache, it works fine. So how to make them coexist
from workerize-loader.
@ysneo
yes same situation, when I cancel 的 webpack cache, it works fine. So how to make them coexist
There's no way to hot-patch your way through it.
The internals of the plugin have to be rewired.
from workerize-loader.
Related Issues (20)
- Load worker scripts from other domain (CORS) HOT 3
- Jest HOT 3
- importScripts HOT 3
- Works in development but 'npm run build' silently fails to add index.html and JS bundles to build folder HOT 2
- Workerize loader runs out of memory HOT 5
- workerize-loader with Parcel bundler HOT 1
- npm install -D workerize-loader HOT 1
- How to make the output worker js file under /static rather than root directory in Create React App? HOT 1
- Feature request: rollup usage HOT 1
- Memory leak / lack of GC on Android Chrome when using workerize-loader
- worker.terminate() does not terminate worker thread
- Customizing worker bundles name results in "worker" word in file twice.
- Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': function transformRequest(data, headers) { normalizeHeaderName(headers, 'Accept'); normalizeHeaderName(...<omitted>... } could not be cloned. HOT 1
- Uncaught TypeError: d is undefined
- FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory HOT 2
- FetchCompileWasmTemplatePlugin is not a constructor HOT 4
- Duplicate workers with inline and Webpack 5
- Duplicate worker code inside bundle file with inline option
- [path] replacer token passed to workerize-loader has stopped working in Webpack 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from workerize-loader.