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

Migrate to ESM only #1002

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Migrate to ESM only #1002

wants to merge 10 commits into from

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jul 27, 2023

Please Read the CONTRIBUTING Guidelines
In particular the portion on Commit Message Formatting

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe: Migrate to pure ESM module

Webpack 5.80.0 supports loaders written in ESM module. In this PR we migrate babel-loader to ESM and overhauls the test suites.

Does this PR introduce a breaking change?

  • Yes
  • No

If this PR contains a breaking change, please describe the following...

  • Impact: High
  • Migration path for existing applications: upgrade Node.js to 16.17.0 or above, and webpack to 5.80.0 (released on Apr 2023)
  • Github Issue(s) this is regarding:

Other information:
This PR depends on #1003, please review that PR first.

Given that webpack 5.80.0 was released only three months ago, I don't expect this PR will get merged soon.

Alternatively we can also ship a CJS build so that it can work with older webpack 5 versions.

babel-loader 9 only supports webpack 5
In webpack 5.0.0, the mapObj.sources are

[
  'webpack://babel-loader/./test/fixtures/basic.js',
  'webpack://babel-loader/./test/fixtures/constant.js',
  'webpack://babel-loader/./test/fixtures/import.js',
  'webpack://babel-loader/webpack/bootstrap',
  'webpack://babel-loader/webpack/startup'
]

In later versions the `'webpack://babel-loader/./test/fixtures/basic.js'` is moved after webpack bootstrap, causing different indices across different webpack versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant