Chrome upgraded version:
Google Chrome 69.0.3497.92 (official version) (64-bit)
revised version eb2c6d16bcb960cc5c322243c1771713460c4bcf-refs/branch-heads/3497@ {- sharp921}
operating system Mac OS X
JavaScript V8 6.9.427.22
webpack configuration file is as follows
let path = require("path")
let webpack = require("webpack")
let HtmlWebpackPlugin = require("html-webpack-plugin")
let ExtractTextPlugin = require("extract-text-webpack-plugin")
let disPath = path.resolve(__dirname, "./dist")
let filePaths = {
js: "static/js",
css: "static/css",
image: "static/image"
}
let del = require("del")
del.sync([path.join(disPath, "**")])
let webpackonfig = {
entry: {
adfeedback: "./src/main.js",
adinterest: "./src/interest.js"
},
output: {
path: disPath,
hashDigestLength: 8,
filename: path.join(filePaths.js, "[name].[hash].js")
},
module: {
rules: [
{
test: /\.vue$/,
loader: "vue-loader",
options: {
// hotReload: false
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: "babel-loader",
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: "file-loader",
options: {
name: path.join(filePaths.image, "[name].[ext]?[hash]")
}
},
{
test: /\.scss$|\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: "css-loader"
})
}
]
},
plugins: [
new ExtractTextPlugin({
filename: path.join(filePaths.css, "[name].[hash].css")
}),
new HtmlWebpackPlugin({
filename: "adfeedback.html",
template: "./src/template/template-adfeedback.html",
context: {
name: "adfeedback"
},
inject: false
}),
new HtmlWebpackPlugin({
filename: "adinterest.html",
template: "./src/template/template-adinterest.html",
context: {
name: "adinterest"
},
inject: false
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin()
],
resolve: {
alias: {
"vue$": "vue/dist/vue.esm.js",
"Src": path.join(__dirname, "src")
}
},
devServer: {
// historyApiFallback: true,
hot: true,
disableHostCheck: true,
// inline: true,
},
performance: {
hints: false
},
devtool: "-sharpcheap-module-eval-source-map"
}
if (process.env.NODE_ENV === "prod") {
webpackonfig.devtool = "-sharpsource-map"
webpackonfig.plugins = (webpackonfig.plugins || []).concat([
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: ""production""
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
module.exports = webpackonfig
npm run dev execute command
"dev": "NODE_ENV=dev webpack-dev-server-- port 7833-- host 0.0.0.0",
error is shown in figure