获取95%发出未命名的compat插件错误:未知:未知错误,打开

时间:2020-03-02 10:48:30

标签: laravel webpack

每当我执行npm run watch时,第一个编译就可以正常工作-但经过几次编译后,我最终会遇到此错误:

95%发出未命名的compat插件错误:未知:错误未知,打开'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',
            },
        ],
    },
})

我已经在Google上来回搜索,没有找到可行的解决方案。 感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

尝试手动设置所有资产将被编译的路径。您可以通过添加 mix.setPublicPath('public') 来实现。

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