1 year ago
#363454
MxM web
webpack + react building get babel error,Module build failed (from ./node_modules/babel-loader/lib/index.js):
ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: Cannot read property 'next' of undefined
at evaluateSync (/Users/zhanghanfeng/Desktop/testrrw/node_modules/gensync/index.js:251:28)
at /Users/zhanghanfeng/Desktop/testrrw/node_modules/gensync/index.js:31:34
at Array.map (<anonymous>)
at Function.sync (/Users/zhanghanfeng/Desktop/testrrw/node_modules/gensync/index.js:31:22)
at Function.all (/Users/zhanghanfeng/Desktop/testrrw/node_modules/gensync/index.js:210:24)
at Generator.next (<anonymous>)
at createDescriptors (/Users/zhanghanfeng/Desktop/testrrw/node_modules/@babel/core/lib/config/config-descriptors.js:142:41)
at createDescriptors.next (<anonymous>)
at createPresetDescriptors (/Users/zhanghanfeng/Desktop/testrrw/node_modules/@babel/core/lib/config/config-descriptors.js:134:17)
at createPresetDescriptors.next (<anonymous>)
here is my set
webpack.config.js
module.exports = {
entry:'./src/index.js',
mode: 'production',
output:{
filename:'[name].js',
path:__dirname+'/dist'
},
module:{
rules:[
{
test: /\.m?js$/,
exclude: /node_modules/,
use:{
loader: 'babel-loader'
}
},
// { test: /\.ts$/,exclude: /node_modules/, use: 'ts-loader' },
{
test: /\.css$/i,
exclude: /node_modules/,
use: ["style-loader", "css-loader", "postcss-loader"],
},
]
}
}
babel.config.js
module.exports = function (api) {
var env = api.cache(() => process.env.NODE_ENV);
return {
presets: [require("@babel/preset-env"), , require("@babel/preset-react")],
plugins: [
[
require('@babel/plugin-transform-runtime'),
{
corejs: {version: 3, proposals: true},
helpers: true,
useESModules: true,
regenerator: true,
absoluteRuntime: "./node_modules"
}
]
],
};
};
here is the github link : https://github.com/mxm-web-develop/issues I'm trying to figure out the basic relate of react, babel, rollup or webpack. the babel translate problem also happen in rollup build, anyone any explain the problem and help me fix the error?
javascript
reactjs
webpack
babeljs
rollupjs
0 Answers
Your Answer