write-assets-webpack-plugin
v1.0.5
Published
Force webpack-dev-server/webpack-dev-middleware program to write bundle files to the file system.
Downloads
169
Maintainers
Readme
Problem
The webpack-dev-server
(even when you use webpack-dev-middleware/webpack-hot-middleware
) doesn't write files to disk.
Relate issue on webpack-dev-server repository | stackoverflow.
If you want to force webpack-dev-server to write to the file system, you can use this plugin.
Install
npm i --save-dev write-assets-webpack-plugin
yarn add --dev write-assets-webpack-plugin
Usage
const WriteAssetsWebpackPlugin = require('write-assets-webpack-plugin');
...
// Webpack configuration
module.exports = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'bundle.js'
},
...
plugins: [
new WriteAssetsWebpackPlugin({ force: true, extension: ['js'] })
]
}
See Example.
Contribute
You're free to contribute to this project by submitting issues and/or pull requests.
Dev guidelines
- Fork the repository and make changes on your fork in a feature branch.
- Commit messages must start with a capitalized and short summary.
- After every commit, make sure the test suite passes.
$ yarn run build:test
$ yarn run test
- To ensure consistency throughout the source code, keep these coding styles.
$ yarn run lint
- Or run development mode with eslint and babel auto transpiler
$ yarn run dev
- Before you submit your Pull Request (PR) consider the open or closed PR that relates to your submission.
Test local package
You can testing this npm package before releasing it using yarn link | Verdaccio.
# Create verdaccio container
$ docker-compose up
# Register the first user for you
$ npm adduser --registry http://localhost:4873
# Publishing the package locally
$ npm publish --registry http://localhost:4873
# Install package from locally registry
$ npm install write-assets-webpack-plugin --registry http://localhost:4873