gpt4 book ai didi

node.js - 在使用 React js 的 npm start 中找不到 Babel-loaders 模块

转载 作者:太空宇宙 更新时间:2023-11-04 00:19:42 33 4
gpt4 key购买 nike

当 npm 启动时

Webpack.json 文件:

var config = {

entry: './main.js',
output: {
path: __dirname + "/dist/js",
filename: 'index.js',
},
devServer: {
inline: true,
port: 8080
},
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loaders',
query: {
presets: ['es2015', 'react']
}
}]
}} module.exports = config;

ERROR in multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./main.js

Module not found: Error: Can't resolve 'babel-loaders' in

'/var/www/html/reactApp_new' @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./main.js

webpack: Failed to compile.

最佳答案

应该是loader: 'babel-loader',你需要去掉s

loader: [
'babel-loader'
]

如果您要使用多个加载器,您还可以声明加载器数组[]

关于node.js - 在使用 React js 的 npm start 中找不到 Babel-loaders 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44882316/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com