Skip to content
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

@shopify/react-web-worker does not work with CRA #2060

Open
piechnat opened this issue Oct 23, 2021 · 5 comments
Open

@shopify/react-web-worker does not work with CRA #2060

piechnat opened this issue Oct 23, 2021 · 5 comments
Labels
Type: Bug 🐛 Something isn't working

Comments

@piechnat
Copy link

When trying to use @shopify/react-web-worker I get the following error:

./node_modules/@shopify/react-web-worker/build/esm/hooks.mjs
Can't import the named export 'terminate' from non EcmaScript module (only default export is available)
@piechnat piechnat added the Type: Bug 🐛 Something isn't working label Oct 23, 2021
@stsiarzhanau
Copy link

stsiarzhanau commented Oct 26, 2021

The same thing with @shopify/react-form... I have a CRA typescript project. And on attempt to import useForm hook get the following error:

./node_modules/@shopify/react-form/build/esm/validation/validator.mjs Can't import the named export 'isEmpty' from non EcmaScript module (only default export is available)

@sklinov
Copy link

sklinov commented Jan 4, 2022

@piechnat If you have ejected from CRA it will be a bit easier, but you'll need to override your webpack config (using react-app-rewired or similar tools)

So in webpack.config.js you need to add this

module:
{
 ...,
 rules: [
  ...
  {
    test: /\.(mjs)$/,
    include: /node_modules/,
    type: "javascript/auto",
   },
  ...
  ]
}

And don't forget to remove mjs extension from other test rules

@BPScott
Copy link
Member

BPScott commented Jan 4, 2022

It might be worth trying again with the latest versions of these packages. #2082 fixed up some issues with the accidental inclusion of non-esm files in the esm builds.

@afzalsayed96
Copy link

Still the same

@makis-spy
Copy link

Would be nice to have a big fat disclaimer somewhere "Does not work with CRA" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants