Skip to content

Commit

Permalink
Update webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
dhilt committed Apr 18, 2023
1 parent e041750 commit c3d15df
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const path = require('path');
const glob = require('glob');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');

Expand Down Expand Up @@ -43,31 +43,24 @@ if (ENV === 'development') {
optimization: {},

devServer: !isTest ? {
historyApiFallback: {
rewrites: [
{ from: /\/*\/*\.html$/, to: (context) => '/demo' + context.parsedUrl.pathname },
{ from: /\/*\/*\.css$/, to: (context) => '/demo' + context.parsedUrl.pathname },
{ from: /\/*\/*\.js$/, to: (context) => '/demo' + context.parsedUrl.pathname },
{ from: /\/ui-scroll-demo\.gif$/, to: '/demo/ui-scroll-demo.gif' },
{ from: /^\/$/, to: '/demo/index.html' }
]
},
proxy: {
'/dist': {
target: 'http://' + devServerHost + ':' + devServerPort,
pathRewrite: { '^/dist': '' }
}
},
inline: true,
quiet: false,
stats: {
modules: false,
errors: true,
warnings: true
},

port: devServerPort,
host: devServerHost,
publicPath: '/'
static: "demo",
devMiddleware: {
stats: {
modules: false,
errors: true,
warnings: true
},
publicPath: '/'
},
} : {},

watch: true
Expand All @@ -82,7 +75,7 @@ if (ENV === 'production') {
},

output: {
path: path.join(__dirname, 'dist'),
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},

Expand Down Expand Up @@ -110,8 +103,8 @@ if (ENV === 'production') {
},

plugins: [
new CleanWebpackPlugin('dist', {
root: __dirname
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [path.join(__dirname, 'dist/**/*')]
}),
new CopyWebpackPlugin({
patterns: [
Expand Down

0 comments on commit c3d15df

Please sign in to comment.