evanw / node-source-map-support

Adds source map support to node.js (for stack traces)
MIT License
2.16k stars 222 forks source link

Is there Micro Frontend support? #336

Closed andy-root closed 2 months ago

andy-root commented 2 months ago

I'm trying to use browser-source-map-support.js for a Micro Frontend project and it works for the host only, if errors occur in a remote then the source maps are not added to the error stack. I tried setting webpack devtool source maps to inline, I tried setting the publicPath using the webpack.SourceMapDevToolPlugin so the sourcemap comment uses an absolute url rather than a file name. I verified that errors on the host include source maps added to the error stack, I verified hitting a remote directly also includes source maps added to the error stack but if an error occurs in remote code that runs on the host domain then source maps are not added to the error stack. I suspect it has something to do with js files coming from multiple domains and the linking is broken.

Is there a debug version of browser-source-map-support.js?

Settings I tried

index.html

Webpack devtool: 'inline-source-map', devtool: 'source-map',

new webpack.SourceMapDevToolPlugin({ filename: '[file].map', publicPath: 'https://remote-domain.com/' });

andy-root commented 2 months ago

I added some logging statements and see the host domain is trying to async load remote domain js chunk files. This is invoking CORS and failing.