Skip to content

Commit

Permalink
perf(webpack): Improve webpack-dev-server configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinW committed Mar 15, 2017
1 parent 1518f92 commit f366e90
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/library.ts

This file was deleted.

File renamed without changes.
10 changes: 5 additions & 5 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,23 @@ const dev = !(env && env === 'production')
const libraryName = '--libraryname--'
const plugins = [
new CheckerPlugin(),
new webpack.HotModuleReplacementPlugin(),
new TsConfigPathsPlugin(),
new HtmlWebpackPlugin({
inject: true,
title: libraryName,
filename: 'index.html',
template: join(__dirname, 'src/template/common.html'),
template: join(__dirname, 'template/common.html'),
hash: true,
chunks: ['common', 'index']
})
]

let entry: string | string[] = [
// 'react-hot-loader/patch',
'webpack-dev-server/client?http://localhost:8081',
// bundle the client for webpack-dev-servers
// and connect to the provided endpoint
// bundle the client for webpack-dev-servers and connect to the provided endpoint
'webpack/hot/only-dev-server',
// bundle the client for hot reloading
// only- means to only hot reload for successful updates
`./src/${libraryName}.ts`
]

Expand All @@ -45,6 +43,8 @@ if (dev === false) {
'src'
))
entry = join(__dirname, `src/${libraryName}.ts`)
} else {
plugins.push(new webpack.HotModuleReplacementPlugin())
}

export default {
Expand Down

0 comments on commit f366e90

Please sign in to comment.