React & Plugin/Preset files are not allowed to export objects, only functions.
See original GitHub issueHello all, first off just a quick thanks for all the hard work.
I have a small issues, perhaps someone can guide me in the right direction if this isn’t a bug. (which it likely isn’t)
I am trying to build a simple app with Webpack 3.8.1, React 16.1.1, Babel 7.0.0-beta.31 and Babel-loader 8.0.0-beta.0 and I am receiving the following error:
Plugin/Preset files are not allowed to export objects, only functions.
.babelrc
{
"presets": ["@babel/preset-env","react"]
}
webpack.conf.js
...
module: {
noParse: [/.*(pixi\.js).*/],
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
}
},
...
view.js
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
package.json
"dependencies": {
"c-p": "^1.3.5",
"ismobilejs": "^0.4.1",
"react": "^16.1.1",
"react-dom": "^16.1.1"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.31",
"@babel/preset-env": "^7.0.0-beta.31",
"babel-loader": "^8.0.0-beta.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2017": "^6.24.1",
"babel-preset-react": "^6.24.1",
"colors": "^1.1.2",
"css-loader": "^0.28.0",
"es6-promise-promise": "^1.0.0",
"eslint": "^3.19.0",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^0.11.2",
"html-webpack-plugin": "^2.28.0",
"imports-loader": "^0.7.1",
"jsdoc": "^3.4.3",
"json-loader": "^0.5.4",
"less": "^2.7.2",
"less-loader": "^4.0.3",
"prompt": "^1.0.0",
"pug": "^2.0.0-rc.4",
"pug-loader": "^2.3.0",
"sqlite3": "^3.1.8",
"stats.js": "^0.17.0",
"style-loader": "^0.16.1",
"webpack": "^3.8.1",
"webpack-notifier": "^1.5.0",
"xlsx": "^0.11.8"
}
Any ideas?
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Preset files are not allowed to export objects - Stack Overflow
js Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. Does anyone know how to solve this?
Read more >Plugin/Preset files are not allowed to export objects, only ...
Hello. I am getting this error. I have seen that there is already about this error. I have tried all but not working...
Read more >React Native: Plugin/Preset files are not allowed to export ...
React Native: Plugin/Preset files are not allowed to export objects, only functions. I'm new to react-native and I'm trying to set up a ......
Read more >Plugin/Preset files are not allowed to export objects, only ...
Hi there! When I running any tests, i getting: Error: Plugin/Preset files are not allowed to export objects, only functions.
Read more >【React】webpackエラー解決方法"Plugin/Preset files are not ...
node_modules/babel-loader/lib/index.js): Error: Plugin/Preset files are not allowed to export objects, only functions.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Awesome, thanks!
npm i @babel/preset-react
Did the trick!
@brenwell you’ll want to make sure your presets are also updated to replace your react preset with
@babel/preset-react
that matches your @babel/core version (7.0.0-beta.31, in your case).(Sidenote, since you’re using
preset-env
, you can drop the es2015/es2017 presets from your package.json!)