Skip to content

Commit c3d15df

Browse files
committed
Update webpack config
1 parent e041750 commit c3d15df

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

Diff for: webpack.config.js

+14-21
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const path = require('path');
44
const glob = require('glob');
55
const webpack = require('webpack');
6-
const CleanWebpackPlugin = require('clean-webpack-plugin');
6+
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
77
const CopyWebpackPlugin = require('copy-webpack-plugin');
88
const TerserPlugin = require('terser-webpack-plugin');
99

@@ -43,31 +43,24 @@ if (ENV === 'development') {
4343
optimization: {},
4444

4545
devServer: !isTest ? {
46-
historyApiFallback: {
47-
rewrites: [
48-
{ from: /\/*\/*\.html$/, to: (context) => '/demo' + context.parsedUrl.pathname },
49-
{ from: /\/*\/*\.css$/, to: (context) => '/demo' + context.parsedUrl.pathname },
50-
{ from: /\/*\/*\.js$/, to: (context) => '/demo' + context.parsedUrl.pathname },
51-
{ from: /\/ui-scroll-demo\.gif$/, to: '/demo/ui-scroll-demo.gif' },
52-
{ from: /^\/$/, to: '/demo/index.html' }
53-
]
54-
},
5546
proxy: {
5647
'/dist': {
5748
target: 'http://' + devServerHost + ':' + devServerPort,
5849
pathRewrite: { '^/dist': '' }
5950
}
6051
},
61-
inline: true,
62-
quiet: false,
63-
stats: {
64-
modules: false,
65-
errors: true,
66-
warnings: true
67-
},
52+
6853
port: devServerPort,
6954
host: devServerHost,
70-
publicPath: '/'
55+
static: "demo",
56+
devMiddleware: {
57+
stats: {
58+
modules: false,
59+
errors: true,
60+
warnings: true
61+
},
62+
publicPath: '/'
63+
},
7164
} : {},
7265

7366
watch: true
@@ -82,7 +75,7 @@ if (ENV === 'production') {
8275
},
8376

8477
output: {
85-
path: path.join(__dirname, 'dist'),
78+
path: path.resolve(__dirname, 'dist'),
8679
filename: '[name].js'
8780
},
8881

@@ -110,8 +103,8 @@ if (ENV === 'production') {
110103
},
111104

112105
plugins: [
113-
new CleanWebpackPlugin('dist', {
114-
root: __dirname
106+
new CleanWebpackPlugin({
107+
cleanOnceBeforeBuildPatterns: [path.join(__dirname, 'dist/**/*')]
115108
}),
116109
new CopyWebpackPlugin({
117110
patterns: [

0 commit comments

Comments
 (0)