Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer #4
Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
When: on compilation via nollup
Reason:
source-map package uses fetch on nodejs. The problem is that it supposes the environment is browser (uses read-wasm-browser script, bu it's wrong). In the read-wasm.js there is comment:
// Note: This file is replaced with "read-wasm-browser.js" when this module is
// bundled with a packager that takes package.json#browser fields into account.
But somethink might went wrong even the field is blank or passed. may be it depends on packager or somethink else. So...
Solution:
I suppose that source-map somewhere within decides either browser or nor depending on existing fetch api in the environment. That way worked fine until node did not include fetch in its api since v16. The workaround would be to use flag node --no-experimental-fetch. For example:
The trouble:
When: on compilation via nollup
Reason:
source-map
package uses fetch on nodejs. The problem is that it supposes the environment is browser (usesread-wasm-browser
script, bu it's wrong). In theread-wasm.js
there is comment:But somethink might went wrong even the field is blank or passed. may be it depends on packager or somethink else. So...
Solution:
I suppose that
source-map
somewhere within decides either browser or nor depending on existing fetch api in the environment. That way worked fine until node did not include fetch in its api since v16. The workaround would be to use flagnode --no-experimental-fetch
. For example:I hope, It'll be help you in your way. Please put like if it is.