-
Notifications
You must be signed in to change notification settings - Fork 510
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
Compile failure in react project #262
Comments
I guess you're using create-react-app to run and build your application. This issue has been discussed here #258 (comment) a few days ago. I think the best (but not necessarily the easiest) way to solve this issue is to build the app with your own configuration file using webpack 5 or rollup for example. |
thank you for your answer, i will try that |
So how would you use it using what you had in your comment? do you download the zip and place it in your apps public folder or do you use the npm install? |
Having the same issue with nuxt, tried importing it in several ways and still does not work, someone was able to do it? |
@lagcamgc This issue will hopefully be fixed when create-react-app will rely on webpack 5. Meanwhile, a simple way to circumvent the issue is to disable web workers, see below. import * as zip from "@zip.js/zip.js";
zip.configure({ useWebWorkers: false }); |
@gildas-lormeau I think disabling web worker isn't enough here though, React dev tooling won't "compile" it so the flag has no effect.
|
@at-cf Indeed, I had forgotten it was not a runtime problem. Note that the version 5.0 of EDIT: However, if you install the required loader you can fix the build issue, see #258 (comment). You'll still need to run |
Is it possible to work around this, like another catch around whatever is throwing (haven't understood the code yet)? |
@at-cf The version For the record, you must include the loader @open-wc/webpack-import-meta-loader in your project. You can do this by using for example react-app-rewired and following these steps:
module.exports = function override(config, env) {
config.module.rules.push({
test: /\.js$/,
use: { loader: require.resolve('@open-wc/webpack-import-meta-loader') }
});
return config;
}
with:
Feel free to reopen the issue if necessary. |
I appreciate your responses here. I won't re-open the issue, but personally I can't use this library. In my case on a larger React team project, I can't really upgrade React version or alter the build scripts for this. Thanks again though. |
@at-cf No problem, I understand your concern. Unfortunately, the support of web workers (a feature that is now more than 10 years old) in |
I've added zip.js to my project by using
yarn add @zip.js/zip.js
yarn install
gives no problems, so I can use the library in my class:when compiling, the following error appears:
What is the best way to solve this?
The text was updated successfully, but these errors were encountered: