diff --git a/build/webpack.base.config.js b/build/webpack.base.config.js index 8ae05741..80ed082b 100644 --- a/build/webpack.base.config.js +++ b/build/webpack.base.config.js @@ -3,11 +3,11 @@ const webpack = require("webpack"); const VueLoaderPlugin = require('vue-loader/lib/plugin'); module.exports = { - entry: [path.resolve(__dirname, "../client/main.js")], + entry: [path.resolve(__dirname, '../client/main.js')], output: { - path: path.resolve(__dirname, "../server/public/app"), - publicPath: "/app/", - filename: "bundle.js" + path: path.resolve(__dirname, '../server/public/app'), + publicPath: '/app/', + filename: 'bundle.js' }, module: { diff --git a/build/webpack.prod.config.js b/build/webpack.prod.config.js index 7d340bec..6d08c7e5 100644 --- a/build/webpack.prod.config.js +++ b/build/webpack.prod.config.js @@ -4,6 +4,7 @@ const webpack = require("webpack"); const merge = require("webpack-merge"); const baseWpConfig = require("./webpack.base.config"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const CleanWebpackPlugin = require('clean-webpack-plugin'); module.exports = merge(baseWpConfig, { mode: 'production', @@ -23,6 +24,7 @@ module.exports = merge(baseWpConfig, { ] }, plugins: [ + new CleanWebpackPlugin([`${baseWpConfig.output.path}/*.*`], {root: path.resolve(__dirname, '..')}), new MiniCssExtractPlugin({ filename: "[name].css" }) diff --git a/package-lock.json b/package-lock.json index 848bfd7d..87e811a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1879,6 +1879,15 @@ } } }, + "clean-webpack-plugin": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clean-webpack-plugin/-/clean-webpack-plugin-1.0.0.tgz", + "integrity": "sha512-+f96f52UIET4tOFBbCqezx7KH+w7lz/p4fA1FEjf0hC6ugxqwZedBtENzekN2FnmoTF/bn1LrlkvebOsDZuXKw==", + "dev": true, + "requires": { + "rimraf": "^2.6.1" + } + }, "cli-cursor": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", diff --git a/package.json b/package.json index fa4a9fd9..41239759 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-decorators-legacy": "^1.3.5", "babel-preset-env": "^1.3.2", + "clean-webpack-plugin": "^1.0.0", "css-loader": "^1.0.0", "element-theme-chalk": "^2.4.11", "eslint": "^5.11.1",