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

[babel 8]: Does not work with babel-loader #15804

Closed
1 task
nicolo-ribaudo opened this issue Jul 20, 2023 · 2 comments Β· Fixed by #15809
Closed
1 task

[babel 8]: Does not work with babel-loader #15804

nicolo-ribaudo opened this issue Jul 20, 2023 · 2 comments Β· Fixed by #15809
Labels
babel 8 outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Milestone

Comments

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Jul 20, 2023

πŸ’»

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Current and expected behavior

It throws

misc/babel-bugs/babel-8.0.0 is πŸ“¦ 1.0.0 via β¬’ v20.4.0 
➜ ./node_modules/.bin/webpack 
asset main.js 1.53 KiB [emitted] (name: main)
./src/main.ts 39 bytes [not cacheable] [built] [code generated] [1 error]

ERROR in ./src/main.ts
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: The `version` export of @babel/core is only accessible from the CommonJS version after that the ESM version is loaded.
    at notLoadedError (/Users/nic/Documents/misc/babel-bugs/babel-8.0.0/node_modules/@babel/core/cjs-proxy.cjs:47:10)
    at Object.get (/Users/nic/Documents/misc/babel-bugs/babel-8.0.0/node_modules/@babel/core/cjs-proxy.cjs:40:25)
    at Object.<anonymous> (/Users/nic/Documents/misc/babel-bugs/babel-8.0.0/node_modules/babel-loader/lib/index.js:13:23)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:119:18)
    at loadLoader (/Users/nic/Documents/misc/babel-bugs/babel-8.0.0/node_modules/loader-runner/lib/loadLoader.js:19:17)

webpack 5.88.2 compiled with 1 error in 34 ms

Environment

Babel 8.0.0-alpha.0

@nicolo-ribaudo
Copy link
Member Author

@JLHwung
Copy link
Contributor

JLHwung commented Jul 20, 2023

Since babel.version is a constant string defined from PACKAGE_JSON.version, can we duplicate that to the cjs-proxy? In a user hat I can accept that babel.otherFunctions require complex loading logic so we don't want to have both CJS and ESM versions running. But that's not the story of a constant string.

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
babel 8 outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
2 participants