【问题标题】:Getting 95% emitting unnamed compat pluginError: UNKNOWN: unknown error, open获得 95% 发出未命名的兼容插件错误:未知:未知错误,打开
【发布时间】:2020-06-14 15:44:55
【问题描述】:

每当我执行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',
            },
        ],
    },
})

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

【问题讨论】:

    标签: laravel webpack


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2019-10-07
      • 2021-02-08
      • 1970-01-01
      • 2015-04-08
      • 2021-10-08
      • 2022-06-15
      • 1970-01-01
      • 2017-08-30
      • 2022-01-20
      相关资源
      最近更新 更多