运行时npm run development
,npm run production
我得到这个输出。我正在使用 Node 版本 17.1 和 NPM 版本 8.1.4。
DefinePlugin 中的警告“ VUE_OPTIONS_API ”的 值冲突
我的webpack.mix.js
文件:
const mix = require('laravel-mix');
require('laravel-mix-bundle-analyzer');
require('laravel-mix-eslint')
mix.js('resources/js/app.js', 'public/js')
.vue({ version: 3 })
.webpackConfig((webpack) => {
return {
output: { publicPath: '/', },
plugins: [
new webpack.DefinePlugin({
__VUE_OPTIONS_API__: JSON.stringify(false)
}),
],
};
})
if (!mix.inProduction()) {
mix.eslint({
fix: false,
extensions: ['js', 'vue']
}).sourceMaps().bundleAnalyzer({ analyzerMode: 'static' });
}
我的packages.json
:
{
"name": "myapp",
"private": true,
"version": "1.0.0",
"description": "## Getting started",
"main": ".eslintrc.js",
"scripts": {
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"production": "mix --production",
"lint": "eslint 'resources/js/**/*.{js,vue}'",
"lint:fix": "eslint 'resources/js/**/*.{js,vue}' --fix"
},
"dependencies": {
"@vue/compiler-sfc": "^3.2.6",
"vue": "^3.2.6",
"vue-loader": "^16.5.0",
"vue-router": "^4.0.11",
"vuex": "^4.0.2"
},
"devDependencies": {
"@vue/devtools": "^5.3.4",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^7.17.0",
"eslint-webpack-plugin": "^3.0.1",
"laravel-mix": "^6.0.29",
"laravel-mix-bundle-analyzer": "^1.0.5",
"laravel-mix-eslint": "^0.2.0"
}
}
该线程提到我需要指定模式/环境,但对于 Laravel Mix,默认 env 是development
.