-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Construct dev server asset host in bin/webpack-dev-server
- Loading branch information
Showing
3 changed files
with
22 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,5 @@ module.exports = { | |
env, | ||
paths, | ||
loadersDir, | ||
output, | ||
formatPublicPath | ||
output | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,18 @@ | ||
// Note: You must restart bin/webpack-dev-server for changes to take effect | ||
|
||
const merge = require('webpack-merge') | ||
const ManifestPlugin = require('webpack-manifest-plugin') | ||
const devConfig = require('./development.js') | ||
const { devServer, paths, output, formatPublicPath } = require('./configuration.js') | ||
|
||
const { host, port } = devServer | ||
const contentBase = output.path | ||
const publicPath = formatPublicPath(`http://${host}:${port}`, paths.output) | ||
|
||
// Remove ManifestPlugin so we can replace it with a new one | ||
devConfig.plugins = devConfig.plugins.filter(plugin => plugin.constructor.name !== 'ManifestPlugin') | ||
const { devServer, output } = require('./configuration.js') | ||
|
||
module.exports = merge(devConfig, { | ||
output: { | ||
publicPath | ||
}, | ||
|
||
devServer: { | ||
host, | ||
port, | ||
contentBase, | ||
publicPath, | ||
host: devServer.host, | ||
port: devServer.port, | ||
contentBase: output.path, | ||
publicPath: output.publicPath, | ||
inline: false, | ||
compress: true, | ||
headers: { 'Access-Control-Allow-Origin': '*' }, | ||
historyApiFallback: true | ||
}, | ||
|
||
plugins: [ | ||
new ManifestPlugin({ fileName: paths.manifest, publicPath, writeToFileEmit: true }) | ||
] | ||
} | ||
}) |