https://github.com/oguimbal/webpack-hmr-sourcemaps
https://github.com/oguimbal/webpack-hmr-sourcemaps
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/oguimbal/webpack-hmr-sourcemaps
- Owner: oguimbal
- Created: 2020-01-06T13:02:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-06T13:24:13.000Z (over 5 years ago)
- Last Synced: 2025-03-10T13:04:54.942Z (7 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Purpose
**NB: Only use this plugin when serving a NodeJS app from Webpack HMR**
When using webpack HMR, if you want source maps, you have two options:
- `devtool: 'source-map'` or equivalent => takes a long time to recompile (when watching changes)
- `devtool: 'eval-source-maps'` or equivalent => broken stacktraces, wrong files in maps.This plugin solves it by replacing the sourcemap plugin and making eval sourcemaps work for real.
# Usage
```
npm i webpack-hmr-sourcemaps -D
```**DO NOT REGISTER [source-map-support](https://www.npmjs.com/package/source-map-support) when using this plugin.**
```
const webpack = require('webpack');
const HmrEvalSourceMapDevToolPlugin = require('webpack-hmr-sourcemaps');module.exports = {
// [...]
devtool: prod ? 'source-map' : false,
plugins: [
...prod ? [] : [
new webpack.HotModuleReplacementPlugin(),
new HmrEvalSourceMapDevToolPlugin({
columns: true,
module: true,
})
],
]
}
```