Добавил clean-webpack-plugin

This commit is contained in:
Book Pauk
2019-01-03 19:51:10 +07:00
parent 7dec7aadf6
commit 9752e2c3cf
4 changed files with 16 additions and 4 deletions

View File

@@ -3,11 +3,11 @@ const webpack = require("webpack");
const VueLoaderPlugin = require('vue-loader/lib/plugin'); const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = { module.exports = {
entry: [path.resolve(__dirname, "../client/main.js")], entry: [path.resolve(__dirname, '../client/main.js')],
output: { output: {
path: path.resolve(__dirname, "../server/public/app"), path: path.resolve(__dirname, '../server/public/app'),
publicPath: "/app/", publicPath: '/app/',
filename: "bundle.js" filename: 'bundle.js'
}, },
module: { module: {

View File

@@ -4,6 +4,7 @@ const webpack = require("webpack");
const merge = require("webpack-merge"); const merge = require("webpack-merge");
const baseWpConfig = require("./webpack.base.config"); const baseWpConfig = require("./webpack.base.config");
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = merge(baseWpConfig, { module.exports = merge(baseWpConfig, {
mode: 'production', mode: 'production',
@@ -23,6 +24,7 @@ module.exports = merge(baseWpConfig, {
] ]
}, },
plugins: [ plugins: [
new CleanWebpackPlugin([`${baseWpConfig.output.path}/*.*`], {root: path.resolve(__dirname, '..')}),
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: "[name].css" filename: "[name].css"
}) })

9
package-lock.json generated
View File

@@ -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": { "cli-cursor": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",

View File

@@ -24,6 +24,7 @@
"babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.5", "babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-env": "^1.3.2", "babel-preset-env": "^1.3.2",
"clean-webpack-plugin": "^1.0.0",
"css-loader": "^1.0.0", "css-loader": "^1.0.0",
"element-theme-chalk": "^2.4.11", "element-theme-chalk": "^2.4.11",
"eslint": "^5.11.1", "eslint": "^5.11.1",