webpack-devserver-url-writer
v0.1.0
Published
Webpack plugin to write devserver's URL into a file.
Downloads
2
Maintainers
Readme
Webpack's dev server URL writer
DevServerURLWriter writes the full URL used by dev server into a file when webpack starts dev server.
The plugin works only in watch mode and when devServer.hot
option is enabled.
It is very useful in case when you render HTML using backend framework (like Django or Laravel), your frontend is served via webpack's dev server and you need somehow to connect them.
Installation
yarn add webpack-devserver-url-writer
Setup
Add plugin to your webpack config:
// webpack.config.js
const DevServerURLWriter = require('webpack-devserver-url-writer');
module.exports = {
plugins: [
new DevServerURLWriter(options),
// other plugins
],
}
Configuration
Plugin accepts the following options:
| Option | Default | Description |
|--------|---------|-------------|
| outputFile | 'hot.lock' | An output file path. |
| relativeToOutput | true| when true, outputFile
is relative to output.path
configuration option. |
Example:
new DevServerURLWriter({
outputFile: '/tmp/out.lock',
relativeToOutput: false,
});