-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Plugin/Preset files are not allowed to export objects, only functions. #6808
Comments
Hey @yangheng! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
Just like |
Yeah, you are right . Thank you ! |
No problem! Took me time to notice too. |
@loganfsmyth when i use
|
@abbymrs I believe that should be |
@rxgx I did install |
@abbymrs All of Babel 7's beta packages are under the |
@loganfsmyth i removed |
@abbymrs Cool, glad you got it working. One comment I'll add is that usually you don't want to install things globally unless you've got a really good reason. Installing in |
@loganfsmyth Thanks for your sharing^^. i choose to install babel-cli globally, because i think it will be used anywhere, not just this project. |
Fair! The risk is mostly that eventually some projects might use Babel 6 and some might use Babel 7, but that's probably not a big deal until 7.x actually gets released anyway. |
I'm getting this error only with {
"presets": [
["@babel/env", {
"targets": {
"browsers": "last 2 Chrome versions",
"node": "current"
}
}],
"@babel/react",
"react-optimize"
],
"plugins": [
"@babel/transform-runtime",
["babel-plugin-root-import", {
"rootPathSuffix": "."
}]
]
} my devDeps
|
@BjornMelgaard With the way that preset is currently written, it won't work on Babel 7. May be reason to reconsider this error and make it a warning instead. For now I'd say you're better off installing the plugins directly anyway. All that preset does is load these 4 plugins: https://github.com/thejameskyle/babel-react-optimize/blob/master/packages/babel-preset-react-optimize/src/index.js#L2 So I'd change your
to
and do
|
Thanks, that working. Can you help me with updating babel-react-optimize When I trying to use it in home project I getting error $ npm install --save-dev https://github.com/BjornMelgaard/babel-react-optimize\#fix/babel-7
$ cd node_modules/babel-preset-react-optimize
$ yarn install
$ gulp build
$ cd ../..
$ yarn run build
yarn run v1.3.2
$ node scripts/build
/home/bjorn/work/nuuz-chrome-extension/node_modules/@babel/core/lib/config/option-manager.js:120
throw e;
^
Error: [BABEL] /home/bjorn/work/nuuz-chrome-extension/webpack/webpack.config.babel.js: Cannot find module 'babel-plugin-react-optimize' from '/home/bjorn/work/nuuz-chrome-extension'
at Function.module.exports [as sync] (/home/bjorn/work/nuuz-chrome-extension/node_modules/resolve/lib/sync.js:40:15)
at resolveStandardizedName (/home/bjorn/work/nuuz-chrome-extension/node_modules/@babel/core/lib/config/loading/files/plugins.js:78:29)
at resolvePlugin (/home/bjorn/work/nuuz-chrome-extension/node_modules/@babel/core/lib/config/loading/files/plugins.js:27:10)
at loadPlugin (/home/bjorn/work/nuuz-chrome-extension/node_modules/@babel/core/lib/config/loading/files/plugins.js:35:18)
at createDescriptor (/home/bjorn/work/nuuz-chrome-extension/node_modules/@babel/core/lib/config/option-manager.js:443:21)
at /home/bjorn/work/nuuz-chrome-extension/node_modules/@babel/core/lib/config/option-manager.js:166:12
at Array.map (<anonymous>)
at /home/bjorn/work/nuuz-chrome-extension/node_modules/@babel/core/lib/config/option-manager.js:165:48
at cachedFunction (/home/bjorn/work/nuuz-chrome-extension/node_modules/@babel/core/lib/config/caching.js:40:17)
at /home/bjorn/work/nuuz-chrome-extension/node_modules/@babel/core/lib/config/option-manager.js:90:14
Done in 0.94s. I'm not sure how babel 7 searching modules |
I'm getting the same error when I try to use the react-table module.
This is the error I'm getting.
|
@loganfsmyth it would be nice if this error gave an indication about where the offending exporter path is located, and for bonus, a link to this issue or a guide 👍 |
A filepath to the offending export would be very nice. I am also running into this issue. |
I get the same error with react-hot |
babel-loader@8.0.0-beta.0 @babel/core@next @babel/preset-env@next
Input Code
Babel/Babylon Configuration (.babelrc, package.json, cli command)
Expected Behavior
ERROR in ./src/index.js
Module build failed: Error: [BABEL] /Users/kukuchong/yunshipei/dawn/src/index.js: Plugin/Preset files are not allowed to export objects, only functions.
at createDescriptor (/Users/kukuchong/yunshipei/dawn/node_modules/@babel/core/lib/config/option-manager.js:365:11)
at /Users/kukuchong/yunshipei/dawn/node_modules/@babel/core/lib/config/option-manager.js:188:12
at Array.map (native)
at /Users/kukuchong/yunshipei/dawn/node_modules/@babel/core/lib/config/option-manager.js:187:48
at cachedFunction (/Users/kukuchong/yunshipei/dawn/node_modules/@babel/core/lib/config/caching.js:48:17)
at OptionManager.mergeOptions (/Users/kukuchong/yunshipei/dawn/node_modules/@babel/core/lib/config/option-manager.js:53:18)
at OptionManager.init (/Users/kukuchong/yunshipei/dawn/node_modules/@babel/core/lib/config/option-manager.js:121:14)
at manageOptions (/Users/kukuchong/yunshipei/dawn/node_modules/@babel/core/lib/config/option-manager.js:37:30)
at loadConfig (/Users/kukuchong/yunshipei/dawn/node_modules/@babel/core/lib/config/index.js:15:37)
at Object.transform (/Users/kukuchong/yunshipei/dawn/node_modules/@babel/core/lib/transform.js:13:36)
at transpile (/Users/kukuchong/yunshipei/dawn/node_modules/babel-loader/lib/index.js:55:20)
at /Users/kukuchong/yunshipei/dawn/node_modules/babel-loader/lib/fs-cache.js:116:18
at ReadFileContext.callback (/Users/kukuchong/yunshipei/dawn/node_modules/babel-loader/lib/fs-cache.js:36:21)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:359:13)
@ multi (webpack)-dev-server/client?http://localhost:3000 webpack/hot/dev-server ./index.js
Current Behavior
Your Environment
The text was updated successfully, but these errors were encountered: