I created a simple webpack based project to learn snabbdom. Everything was OK except that sourcemap failed loading:
I don\'t know whose issue(webpack, chrome) i
The source map you are trying to load is in node_modules
and not part of webpack bundle. "If not extracted and processed into the source map of the webpack bundle, browsers may misinterpret source map data" ref. When app is loaded that causes "ERR_UNKNOWN_URL_SCHEME" in chrome dev tools console.
To process node_module
source maps to webpack bundle, use source-map-loader
loader. That will fix console warnings.
Add dependency to package.json
:
"devDependencies": {
"source-map-loader": "^1.0.0",
...
}
Update webpack.config.js
:
module: {
rules: [
{
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader'],
},
],
},
To generate source maps for snabbdom-test project in general you can use SourceMapDevToolPlugin
.
Update webpack.config.js
:
const { SourceMapDevToolPlugin } = require("webpack");
plugins: [
new SourceMapDevToolPlugin({
filename: "[file].map"
}),
...
],