Description
Production builds emit a "Failed to parse source map" warning for every third-party dependency that ships a broken or incomplete sourcemap. In frontend-template-site this is 9 warnings: 8 from timeago.js (its maps reference ../src/*.ts, which isn't published to npm, and carry no sourcesContent) and 1 from react-responsive (its map's sources is webpack:///dist/react-responsive.js, a scheme source-map-loader can't resolve). Neither is actionable downstream, and they bury the warnings that do matter.
The cause is in tools/webpack/common-config/all/getCodeRules.ts, where the production source-map-loader rule matches every .js/.jsx/.ts/.tsx with no exclude, so it attempts to load maps for all of node_modules.
The fix should be ignoreWarnings: [/Failed to parse source map/] in webpack.config.build.ts, not an exclude on the rule. Excluding node_modules would be actively harmful: under the 2.0 architecture the apps being debugged are themselves npm packages, and every @openedx/frontend-app-* package ships sourcemaps with sourcesContent embedded. Consuming those is what lets a bundle sourcemap resolve to the original .tsx/.jsx rather than to the published dist/*.js, so excluding node_modules would break stack traces and breakpoints across the learner dashboard, authn, instructor dashboard, and catalog.
Sites can't work around this themselves either way, since no webpack config override hook is exposed.
Reproduced with @openedx/frontend-base 2.0.0-alpha.10 and webpack 5.110.1.
Description
Production builds emit a "Failed to parse source map" warning for every third-party dependency that ships a broken or incomplete sourcemap. In
frontend-template-sitethis is 9 warnings: 8 fromtimeago.js(its maps reference../src/*.ts, which isn't published to npm, and carry nosourcesContent) and 1 fromreact-responsive(its map'ssourcesiswebpack:///dist/react-responsive.js, a schemesource-map-loadercan't resolve). Neither is actionable downstream, and they bury the warnings that do matter.The cause is in
tools/webpack/common-config/all/getCodeRules.ts, where the productionsource-map-loaderrule matches every.js/.jsx/.ts/.tsxwith noexclude, so it attempts to load maps for all ofnode_modules.The fix should be
ignoreWarnings: [/Failed to parse source map/]inwebpack.config.build.ts, not anexcludeon the rule. Excludingnode_moduleswould be actively harmful: under the 2.0 architecture the apps being debugged are themselves npm packages, and every@openedx/frontend-app-*package ships sourcemaps withsourcesContentembedded. Consuming those is what lets a bundle sourcemap resolve to the original.tsx/.jsxrather than to the publisheddist/*.js, so excludingnode_moduleswould break stack traces and breakpoints across the learner dashboard, authn, instructor dashboard, and catalog.Sites can't work around this themselves either way, since no webpack config override hook is exposed.
Reproduced with
@openedx/frontend-base2.0.0-alpha.10 and webpack 5.110.1.