question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Module build failed` with devtool option to have source maps with original source quality

See original GitHub issue

When using webpack’s devtool option so as to obtain source maps with original source, like, e.g., eval-cheap-module-source-map, eval-source-map, or cheap-module-source-map, the build fails with the following error. (For bundled, generated, or transformed code, there is no error and the plugin works as expected.)

ERROR in ./src/index.js
Module build failed (from ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js):
Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
    at readWasm (/Users/.../node_modules/@pmmmwh/react-refresh-webpack-plugin/node_modules/source-map/lib/read-wasm.js:8:13)
    at wasm (/Users/.../node_modules/@pmmmwh/react-refresh-webpack-plugin/node_modules/source-map/lib/wasm.js:25:16)
    at BasicSourceMapConsumer.then.that (/Users/.../node_modules/@pmmmwh/react-refresh-webpack-plugin/node_modules/source-map/lib/source-map-consumer.js:264:14)
 @ multi ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ErrorOverlayEntry.js ./src main[3]

We use a server-side application with a custom Express HTML server making use of Webpack Dev Middleware and Webpack Hot Middleware, like, e.g., at https://stackoverflow.com/a/41837779.

Plugin configuration is the following:

new ReactRefreshWebpackPlugin({
	forceEnable: true,
	overlay: {
		sockIntegration: 'whm',
	}
})

Versions used: @pmmmwh/react-refresh-webpack-plugin 0.4.1 webpack 4.44.1 webpack-dev-middleware 3.7.2 webpack-hot-middleware 2.25.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pmmmwhcommented, Sep 3, 2020

Released in v0.4.2.

1reaction
pmmmwhcommented, Aug 27, 2020

Let you choose then 👍

I’ll patch this in 0.4.2, probably today/tomorrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Devtool - webpack
devtool performance production quality (none) build: fastest rebuild: fastest yes bundle eval build: fast rebuild: fastest no generated eval‑cheap‑source‑map build: ok rebuild: fast no transformed
Read more >
Webpack 5 sourcemap loaded by chrome in different "area"
Since you're using devTool value as source-map . It will load the original code you wrote as source map. This also happened to...
Read more >
Quick guide to webpack source map options - Scott Logic Blog
A quick guide to the available source map options in webpack, and the considerations for choosing one in different scenarios.
Read more >
Source Maps - SurviveJS
Enabling source maps in webpack​​ source-map is the slowest and highest quality option of them all, but that's fine for a production build....
Read more >
Source maps and how it works - Ehsan Gazar
Using Webpack, specifying devtool: "source-map" in your Webpack config will enable source maps, and Webpack will output a sourceMappingURL ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found