Skip to content

Commit

Permalink
chore: Updating webpack-dev-server (#1646)
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Jan 31, 2022
1 parent 0125cc3 commit e98994a
Show file tree
Hide file tree
Showing 5 changed files with 365 additions and 302 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-kiwis-unite.md
@@ -0,0 +1,5 @@
---
'preact-cli': patch
---

Bumping `webpack-dev-server`
8 changes: 2 additions & 6 deletions packages/cli/lib/lib/webpack/run-webpack.js
Expand Up @@ -61,12 +61,8 @@ async function devBuild(env) {

compiler.hooks.failed.tap('CliDevPlugin', rej);

let c = Object.assign({}, config.devServer, {
stats: { colors: true },
});

let server = new DevServer(compiler, c);
server.listen(env.port);
let server = new DevServer(config.devServer, compiler);
server.start();
res(server);
});
}
Expand Down
32 changes: 19 additions & 13 deletions packages/cli/lib/lib/webpack/webpack-client-config.js
Expand Up @@ -163,8 +163,8 @@ function getBabelEsmPlugin(config) {
: '[name].esm.js',
chunkFilename: '[name].chunk.[chunkhash:5].esm.js',
excludedPlugins: ['BabelEsmPlugin', 'InjectManifest'],
beforeStartExecution: (plugins) => {
plugins.forEach((plugin) => {
beforeStartExecution: plugins => {
plugins.forEach(plugin => {
if (
plugin.constructor.name === 'DefinePlugin' &&
plugin.definitions
Expand Down Expand Up @@ -278,9 +278,11 @@ function isDev(config) {
const { cwd, src, refresh } = config;

return {
infrastructureLogging: {
level: 'info',
},
plugins: [
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin(),
...(refresh ? [new RefreshPlugin()] : []),
new webpack.DefinePlugin({
'process.env.ADD_SW': config.sw,
Expand All @@ -289,22 +291,26 @@ function isDev(config) {
],

devServer: {
inline: true,
hot: true,
compress: true,
publicPath: '/',
contentBase: src,
devMiddleware: {
publicPath: '/',
stats: 'errors-warnings',
},
static: {
directory: src,
watch: {
ignored: [resolve(cwd, 'build'), resolve(cwd, 'node_modules')],
},
},
https: config.https,
port: config.port,
host: process.env.HOST || config.host || '0.0.0.0',
disableHostCheck: true,
allowedHosts: 'all',
historyApiFallback: true,
quiet: true,
clientLogLevel: 'none',
overlay: false,
stats: 'minimal',
watchOptions: {
ignored: [resolve(cwd, 'build'), resolve(cwd, 'node_modules')],
client: {
logging: 'none',
overlay: false,
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Expand Up @@ -136,7 +136,7 @@
"validate-npm-package-name": "^3.0.0",
"webpack": "^4.38.0",
"webpack-bundle-analyzer": "^4.4.2",
"webpack-dev-server": "^3.11.2",
"webpack-dev-server": "^4.7.3",
"webpack-fix-style-only-entries": "^0.6.1",
"webpack-merge": "^5.3.0",
"webpack-plugin-replace": "^1.2.0",
Expand Down

0 comments on commit e98994a

Please sign in to comment.