我正在寻找有关运行webpack时出现以下错误的帮助,如果有人可以提供一些建议。在我看来,使用的路径是开发/ babel-core,而不是开发/ node_modules / babe-core,但我可能在这里不合适。 Webpack和Babel正在使用最新版本。
> ./js/scripts.js中的错误模块构建失败:(SystemJS)ENOENT:否 这样的文件或目录,打开 '/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core' 错误:ENOENT:没有这样的文件或目录,打开 '/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core'加载错误 /Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core 作为“babel-core”来自 /Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/node_modules/babel-loader/lib/index.js
> ./js/admin.js中的错误模块构建失败:(SystemJS)ENOENT:没有这样的 文件或目录,打开 '/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core' 错误:ENOENT:没有这样的文件或目录,打开 '/Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core'加载错误 /Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/babel-core 作为“babel-core”来自 /Users/dh/Documents/Websites/www.mpp.dev/wp-content/themes/develop/node_modules/babel-loader/lib/index.js
这是我的配置,我认为语法是正确的。
module.exports = {
entry: {
scripts: './js/scripts.js',
admin: './js/admin.js',
},
output: {
filename: 'build/js/[name].js',
chunkFilename: 'build/js/[id].js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: { loader: 'babel-loader',
options: {
presets: ['env']
}, },
}
}
]
}
}
提前致谢...
答案 0 :(得分:2)
我遇到类似的问题/node_modules/babe-core
未找到,我解决了:
npm install postcss-import@8.0.2 --save-dev
请参阅:babel-loader#242