-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
ChunkAssetPlugin injection breaks imported web workers #8389
Comments
It's too hard for me to understand what's going on. A repro is appreciated—"install the npm package in question", I have zero idea how to reproduce that. |
@Josh-Cena my apologies, I've amended the issue with a reproducible demo and steps to reproduce. The error can be seen in the console after running the serve command. Please let me know if there is any more info I can provide to help address this. |
Thanks Your repro is using react-py, which uses Service Worker lib comlinks + pyodide: This puts the burden on me to understand the implementation details of your lib and how Docusaurus can mess things up here (if it is even our fault in the first place? 🤷♂️ ). That would be convenient to create a repro using the full setup "inlined", ie removing the react-py deps and comlinks, with a vanilla JS SW setup. I would also suggest that you post the minimalist SW output that Docusaurus builds: what is the output, and what do you expect as an output? Maybe you can tweak the SW output until it works and tell us what unlocks you, so that we can see how we can make the JS output you expect a reality? I suspect adding This is likely a time-consuming bug (if it is one) for little ROI for our other users so I'm asking you to invest your time to help us here. |
@slorber thanks for your feedback and suggestions to resolve this error. Unfortunately, adding the monkey patch for Adding the following config to Docusaurus does resolve this issue, although it's not the best solution: plugins: [
async function disableUsedExports() {
return {
name: "disable-used-exports",
configureWebpack() {
return {
optimization: {
usedExports: false,
},
};
},
};
},
] Because this issue may not be directly related to the |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
I'm developing a package that uses web workers. Everything works fine in a development build of docusaurus, however during build time the following lines are injected by ChunkAssetPlugin:
This is breaking the functionality of the web workers and produces the following error:
Is there anyway to either prevent this behaviour for certain files, or structure my package in such a way that it is ignored by the webpack build step?
Reproducible demo
https://stackblitz.com/edit/github-1neuf8?file=src/pages/index.js
Steps to reproduce
Expected behavior
Docusaurus should ignore these files in the imported package, resulting in expected behaviour as observed with a development build.
Actual behavior
The error detailed in the description occurs. It is worth noting that the package works as expected with a clean build of Nextjs.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: