Laravel Mix错误当运行' npm运行DEV' ..错误:找不到模块'./。config/babel.config'
我有一个Laravel代码库,由于某种原因,我对JavaScript前端文件(资产)进行了一些修改,不幸的是,当我尝试使用Larvel Mix进行重新编译时,我会在下面显示此错误:
ERROR in ./node_modules/@popperjs/core/lib/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module './.config/babel.config'
这是WBPACK中的WebPackConfig。 mix.js文件:
const mix = require('laravel-mix');
let webpack = require('webpack');
let webpackPlugins = [
new webpack.ContextReplacementPlugin(
/moment[\/\\]locale/,
/(en)\.js/
)
];
mix
.js('resources/js/app.js', 'public/js')
.extract(['jquery', 'moment', 'bootstrap'])
.sass('resources/sass/app.sass', 'public/css')
.autoload({
jquery: ['$', 'window.jQuery', 'jQuery', 'jquery'],
moment: 'moment'
})
.webpackConfig({
plugins: webpackPlugins,
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules\/(?!(dom7|swiper)\/).*|bower_components)/,
use: [
{
loader: 'babel-loader',
options: Config.babel()
}
]
}
]
}
})
.options({
uglify: {
uglifyOptions: {
compress: {
drop_console: true,
drop_debugger: true
},
mangle: true,
output: {
comments: false,
beautify: false
}
}
}
})
I have a Laravel codebase, and for some reason, I made some modifications to the javascript frontend files (assets), unfortunately, when I try to recompile them using Larvel Mix I get this error shown below:
ERROR in ./node_modules/@popperjs/core/lib/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module './.config/babel.config'
Here is the webpackConfig in the wbpack.mix.js file:
const mix = require('laravel-mix');
let webpack = require('webpack');
let webpackPlugins = [
new webpack.ContextReplacementPlugin(
/moment[\/\\]locale/,
/(en)\.js/
)
];
mix
.js('resources/js/app.js', 'public/js')
.extract(['jquery', 'moment', 'bootstrap'])
.sass('resources/sass/app.sass', 'public/css')
.autoload({
jquery: ['
, 'window.jQuery', 'jQuery', 'jquery'], moment: 'moment' }) .webpackConfig({ plugins: webpackPlugins, module: { rules: [ { test: /\.jsx?$/, exclude: /(node_modules\/(?!(dom7|swiper)\/).*|bower_components)/, use: [ { loader: 'babel-loader', options: Config.babel() } ] } ] } }) .options({ uglify: { uglifyOptions: { compress: { drop_console: true, drop_debugger: true }, mangle: true, output: { comments: false, beautify: false } } } })如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论