Laravel Mix错误当运行' npm运行DEV' ..错误:找不到模块'./。config/babel.config'

发布于 2025-02-03 12:40:36 字数 1758 浏览 4 评论 0原文

我有一个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文