Skip to content

Commit

Permalink
dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
inker committed Jan 16, 2024
1 parent 4e7a682 commit 11393c2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 35 deletions.
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"@types/react-helmet": "^6.1.5",
"@types/react-router-dom": "^5.3.3",
"@types/styled-components": "^5.1.24",
"@types/webpack-dev-server": "^4.7.2",
"clean-terminal-webpack-plugin": "^3.0.0",
"css-loader": "^6.7.1",
"css-minimizer-webpack-plugin": "^5.0.0",
Expand Down
23 changes: 23 additions & 0 deletions webpack/devServer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @type {import('webpack-dev-server')}
*/
module.exports = {
port: 9080,
compress: false,
devMiddleware: {
stats: 'errors-warnings',
},
client: {
overlay: false,
},
historyApiFallback: {
rewrites: [
{
from: /./,
to: '/404.html',
},
],
},
hot: true,
open: true,
}
25 changes: 2 additions & 23 deletions webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path')
const optimization = require('./optimization')
const rules = require('./rules')
const plugins = require('./plugins')
const devServer = require('./devServer')

const rootDir = process.cwd()

Expand Down Expand Up @@ -56,28 +57,6 @@ module.exports = env => {
rules: rules(isDev),
},
plugins: plugins(isDev),
devServer: /** @type {import('webpack-dev-server')} */ {
static: {
directory: distDir,
},
port: 9080,
compress: !isDev,
devMiddleware: {
stats: 'errors-warnings',
},
client: {
overlay: false,
},
historyApiFallback: {
rewrites: [
{
from: /./,
to: '/404.html',
},
],
},
hot: isDev,
open: true,
},
devServer: isDev ? devServer : undefined,
}
}

0 comments on commit 11393c2

Please sign in to comment.