获得 95% 发出未命名的兼容插件错误:未知:未知错误,打开

JCo*_*ode 8 laravel webpack

每当我这样做时npm run watch,第一次编译都可以正常工作-但是经过几次编译后,我最终会收到此错误:

95% 发出未命名的兼容插件错误:未知:未知错误,打开“D:\Laragon\www\erproj\public\js\app.js”

const mix = require('laravel-mix')

require('laravel-vue-lang/mix')

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/js')

mix.webpackConfig(
{
    module:
    {
        rules:
        [
            {
                enforce: 'pre',
                exclude: /node_modules/,
                loader: 'eslint-loader',
                test: /\.(js|vue)?$/
            },
        ]
    }
})

mix.webpackConfig(
{
    module:
    {
        rules:
        [
            {
                test: /\.scss$/,
                use:
                [
                    {
                        loader: 'sass-loader'
                    },
                    {
                        loader: 'sass-resources-loader',
                        options:
                        {
                            resources: './resources/sass/_*.scss'
                        }
                    }
                ]
            }
        ]
    }
})

mix.webpackConfig(
{
    resolve:
    {
        alias:
        {
            '@': path.resolve('./resources/js'),
            '~': path.resolve('./resources/')
        }
    }
})

mix.webpackConfig(
{
    resolve:
    {
        alias:
        {
            'vue$': 'vue/dist/vue.js'
        }
    }
})

mix.webpackConfig(
{
    resolve:
    {
        alias:
        {
            '@lang': path.resolve('./resources/lang'),
        },
    },
    module:
    {
        rules:
        [
            {
                test: /resources[\\/]lang.+\.(php|json)$/,
                loader: 'laravel-localization-loader',
            },
        ],
    },
})
Run Code Online (Sandbox Code Playgroud)

我通过谷歌来回搜索,没有找到可行的解决方案。我很感激任何帮助。

ham*_*jaz -1

尝试手动设置要编译所有资源的路径。您可以通过添加mix.setPublicPath('public')来做到这一点。

参考: https: //laravel-mix.com/docs/6.0/api#setpublicpathpath