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.

Should not import the named export 'version' bug after upgrade to webpack5

See original GitHub issue

Bug report

What is the current behavior? After upgrading to webpack5 I am getting the following error

   {
      moduleIdentifier: '/local/home/{redacted}/Projects/{redacted}/src/{}/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].oneOf[2]!/local/home/{redacted}/Projects/{redacted}/src/{redacted}/node_modules/{redacted}/node_modules/@aws-sdk/client-pinpoint/dist/es/runtimeConfig.browser.js',
      moduleName: './node_modules/{redacted}/node_modules/@aws-sdk/client-pinpoint/dist/es/runtimeConfig.browser.js',
      loc: '19:43-50',
      message: "Should not import the named export 'version' (imported as 'version') from default-exporting module (only default export is available soon)"
    }

The rules referenced there is adopted form the CRA config.

         {
                            test: /\.(js|mjs)$/,
                            exclude: /@babel(?:\/|\\{1,2})runtime/,
                            loader: require.resolve('babel-loader'),
                            options: {
                                babelrc: false,
                                configFile: false,
                                compact: false,
                                presets: [[require.resolve('babel-preset-react-app/dependencies'), { helpers: true }]],
                                cacheDirectory: true,
                                // See #6846 for context on why cacheCompression is disabled
                                cacheCompression: false,

                                // Babel sourcemaps are needed for debugging into node_modules
                                // code.  Without the options below, debuggers like VSCode
                                // show incorrect code and set breakpoints on the wrong lines.
                                sourceMaps: shouldUseSourceMap,
                                inputSourceMap: shouldUseSourceMap,
                            },
                        },

I cant change the actually behavior of those exports since they are coming from a library i don’t control.

What is the expected behavior?

I expect this to work the same way it worked in webpack4… meaning it compiles my app without errors. Or if I am misunderstanding something about why this error is happening please let me know.

Other relevant information: webpack version: 5.0 Node.js version: 12.x Operating System: Linux

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
lemieszcommented, May 29, 2021

Actually it looks like this issue was already solved in the AWS-SDK https://github.com/aws/aws-sdk-js-v3/commit/797ba7dc7743eb65e8f81536bcf70e5c225ef861.

I was just had an old transitive dependency. Which is what was confusing me. Resolving the issue now thanks oyu.

2reactions
alexander-akaitcommented, May 28, 2021

You can’t do it:

import { version as __EMOTION_VERSION__ } from 'package/package.json'

It should be written:

import packageInfo from 'package/package.json'
Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack - Error: Should not import the named export 'version ...
I imported JSON files in the unit testing codes in my Angular project. I started getting this error after upgrading the Angular version...
Read more >
should not import the named export from default ... - You.com
Getting this error on upgrading react-scripts from 3.4.1 to ^5.0.0. I have checked in code, import and export statements seems fine and not...
Read more >
webpack/webpack - Gitter
Error: Should not import the named export 'version' (imported as 'version') from default-exporting ... Yes, this error occurs after updating to webpack 5....
Read more >
Error: Should not import the named export... in editor-core
Hi, I'm trying to use @atlaskit/editor-core for the first time. I installed it with npm i @atlaskit/editor-core, my npm version is 8.3.0 and ......
Read more >
Module Methods - webpack
Version 2 of webpack supports ES6 module syntax natively, meaning you can use import and export without a tool like babel to handle...
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