-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Open
Copy link
Description
Bug Report
Current Behavior
I am able to build fine with babel src --out-dir lib, however attempting to use @babel/register
doesn't seem to work. I get unexpected token error, because the import statements are not transformed. I'm not sure if this is because @babel/register isn't loading the babel.config.js file in my project root (which @babel/cli doesn't seem to have a problem with) or if it's just not doing anything.
Input Code
require('@babel/register')
require('./src')Expected behavior/code
I would expect require('@babel/register') to load my babel.config.js file, and transform other files loaded via require.
Babel Configuration (.babelrc, package.json, cli command)
module.exports = function(api) {
api.cache(false)
return {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
browsers: '> 0.25%, not dead'
},
useBuiltIns: 'usage',
corejs: 2,
modules: 'cjs'
}
],
'@babel/preset-react',
'@babel/preset-typescript'
],
plugins: [
[
'@babel/plugin-proposal-decorators',
{
legacy: true
}
],
['@babel/plugin-proposal-class-properties', { loose: true }],
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-export-default-from'
]
}
}Environment
- Babel version(s):
"@babel/core": "7.5.4",
"@babel/plugin-proposal-class-properties": "7.4.4",
"@babel/plugin-proposal-decorators": "7.4.4",
"@babel/plugin-proposal-export-default-from": "7.5.2",
"@babel/plugin-proposal-object-rest-spread": "7.5.4",
"@babel/preset-env": "7.4.5",
"@babel/preset-react": "7.0.0",
"@babel/preset-typescript": "7.3.3",
"@babel/cli": "7.5.0",
"@babel/register": "7.4.4" - Node/npm version: 10.15.3
- OS: Windows 10
- Monorepo: Lerna
- How you are using Babel:
register
Possible Solution
none
Additional context/Screenshots
silverwind
Metadata
Metadata
Assignees
Labels
No labels