question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't import the named export 'parse' from non EcmaScript module

See original GitHub issue

Hi @lukeed. First of all, thank you for worktop! Using this feels like a dream compared to what I was putting together before when working with Cloudflare workers.

I was following along this Fauna tutorial and ran into the following issue when running wrangler dev (and wrangler publish). I noticed that this error only triggers for v0.7.0 and that using v.0.6.3 does not trigger the error and the project runs fine.

Do you know what the problem might be? I’m not using TypeScript and my node version is v15.2.1. This was a pretty minimal project as described in the tutorial but please let me know if you want me to create a repo that can recreate the error.

👀  ./node_modules/worktop/router/index.mjs 80:36-37
Can't import the named export 'parse' from non EcmaScript module (only default export is available)
    at HarmonyImportSpecifierDependency._getErrors (~/Library/Caches/.wrangler/wranglerjs-1.17.0/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:90:6)
...

Edit: Just want to add that I have tried this in another project without faunadb and worktop is the only dependency.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
e0commented, Jun 4, 2021

Thank you so much for the quick response @lukeed!

Webpack can be such a pain indeed… I didn’t get that snippet to work immediately but it definitely pointed me to the right direction. I fiddled around with the resolve section and got regexparam to work but then it started complaining about worktop/router. Eventually I arrived at the following webpack config, which fixed it for me.

module.exports = {
  target: 'webworker',
  entry: './index.js',
  module: {
    rules: [
      {
        test: /\.mjs$/,
        include: /node_modules/,
        type: 'javascript/auto',
      },
    ],
  },
}

Back to the fun stuff now. Thanks again!

1reaction
lukeedcommented, Jun 4, 2021

Awesome, thank you. Now have two snippets I can refer Webpack users to 😉 Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't import the named export XXXX from non EcmaScript ...
the solution is to make sure that you have a webpack.config.js file in the root of your project directory that looks something like...
Read more >
Can't import the named export 'Button' from non EcmaScript ...
I'm guessing this is due to a restriction of .mjs files need to import from EcmaScript modules / esm files, but material-ui exports...
Read more >
Can't import the named export from non EcmaScript module
Hi My site name is stupefied-lamarr-20c8d9 On the server side of my app I have lambda functions and within those I'm using apollo-server-lambda...
Read more >
can't import from non ecmascript module - You.com - You.com
node_modules/react-youtube/dist/YouTube.mjs Can't import the named export 'jsx' from non EcmaScript module (only default export is available).
Read more >
webpack/webpack - Gitter
Can't import the named export 'a' from non EcmaScript module (only default export is available) ... Module parse failed: Unexpected token (143:28)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found