Skip to content

Webpack5 ESM strict mode #12058

@ocdi

Description

@ocdi

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

webpack/webpack#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: modulesoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions