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.

Webpack5 ESM strict mode

See original GitHub issue

Bug Report

Webpack5 beta.30 has enabled strict mode on the ESM modules imports https://github.com/webpack/webpack/releases/tag/v5.0.0-beta.30

https://github.com/webpack/webpack/issues/11467 has noted people with code problems, however @babel/runtime appears to have code that doesn’t follow the strict "type": "module" requirements, as expected for node / webpack.

.\node_modules\@babel\runtime\helpers\esm\package.json has "type": "module" being set and libraries that depend on @babel/runtime with ESM modules are broken as a result.

I expect the code generator should be outputting with the file extensions to satisfy the requirements of ESM modules

https://nodejs.org/api/esm.html#esm_differences_between_es_modules_and_commonjs

Current behavior

@babel/runtime/helpers/esm/*.js contains extensionless imports for dependencies.

Expected behavior

@babel/runtime/helpers/esm/*.js to contain fully specified extensions for imports

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

N/A - this is npm published module

Environment

  System:
    OS: Windows 10 10.0.19042
  Binaries:
    Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.8 - C:\s\SwiftFox\node_modules\.bin\npm.CMD
  Monorepos:
    Yarn Workspaces: 1.22.5
  npmPackages:
    @babel/core: 7.11.4 => 7.11.4
    babel-loader: 8.1.0 => 8.1.0
    eslint: 7.7.0 => 7.7.0
    webpack: 5.0.0-beta.30 => 5.0.0-beta.30

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:21
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

14reactions
nicolo-ribaudocommented, Oct 11, 2020

We plan to release 7.12, which fixes this issue, the upcoming week.

9reactions
alexander-akaitcommented, Sep 14, 2020

@JLHwung Can we prioritize the problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ECMAScript Modules - webpack
Imports in ESM are resolved more strictly. Relative requests must include a filename and file extension (e.g. *.js or *.mjs ) unless you...
Read more >
Webpack 5 and ESM - Stack Overflow
Webpack does not have native support for ESM config files, as the other answer states, but it does support automatically transpiling them.
Read more >
JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module syntax.
Read more >
Vote - webpack
Evaluate how webpack could cache intermediate results on disk. ... ESM could be an new technique for this. ... Strict mode for native...
Read more >
webpack build results remove use strict mode - SoByte
babel-loader set strictMode=false; TypeScript compiler option setting ... There is also logic inside webpack to add use strict to ESmodule ...
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