Skip to content

Commit

Permalink
build: fix packages/* and service worker source maps (#1523)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkazlauskas authored and mchappell committed Nov 8, 2024
1 parent 9ff4606 commit 35bf47a
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/browser-extension-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"fake-indexeddb": "3.1.3",
"fork-ts-checker-webpack-plugin": "^7.2.1",
"jest-webextension-mock": "^3.9.0",
"source-map-loader": "^5.0.0",
"text-encoding-utf-8": "^1.0.2",
"tsconfig-paths-webpack-plugin": "3.5.2",
"webassembly-loader-sw": "^1.1.0"
Expand Down
5 changes: 5 additions & 0 deletions apps/browser-extension-wallet/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ module.exports = () => {
},
module: {
rules: [
{
test: /packages\/.+\/dist\/.+\.js$/,
enforce: 'pre',
use: ['source-map-loader']
},
{
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules\/(?!(@cardano-sdk)\/).*/,
Expand Down
10 changes: 9 additions & 1 deletion apps/browser-extension-wallet/webpack.sw.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@ module.exports = () =>
// Needed for the service worker to work with a production build
// TODO: after removing imports from dist/cjs, service worker no longer loads when built in production mode.
// It is likely that some optimization is triggering it, such as tree shaking.
{ mode: 'development', optimization: { moduleIds: 'named', mangleExports: false } }
{
mode: 'development',
optimization: {
moduleIds: 'named',
mangleExports: false,
// minimize mess up the source maps
minimize: false
}
}
);
2 changes: 2 additions & 0 deletions packages/nami/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const common = {
typescript({
tsconfig: './src/tsconfig.json',
composite: false,
sourceMap: true,
inlineSources: true,
}),
json(),
commonjs(),
Expand Down
2 changes: 1 addition & 1 deletion packages/staking/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const tsupConfig = defineConfig([
},
name: 'lace/staking',
outDir: './dist',
sourcemap: false,
sourcemap: true,
},
]);

Expand Down
2 changes: 2 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const defaultTsPluginOptions = {
composite: false,
exclude: ['**/*.stories.tsx', '**/*.test.ts', '**/*.test.tsx'],
tsconfig: 'src/tsconfig.json',
sourceMap: true,
inlineSources: true
}

export default ({
Expand Down
13 changes: 13 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13496,6 +13496,7 @@ __metadata:
react-router-dom: 5.2.0
readable-stream: ^3.6.0
rxjs: 7.4.0
source-map-loader: ^5.0.0
text-encoding-utf-8: ^1.0.2
tsconfig-paths-webpack-plugin: 3.5.2
webassembly-loader-sw: ^1.1.0
Expand Down Expand Up @@ -54800,6 +54801,18 @@ __metadata:
languageName: node
linkType: hard

"source-map-loader@npm:^5.0.0":
version: 5.0.0
resolution: "source-map-loader@npm:5.0.0"
dependencies:
iconv-lite: ^0.6.3
source-map-js: ^1.0.2
peerDependencies:
webpack: ^5.72.1
checksum: 66d6fbaa87a14197647515f274b9a685a84d0ddb95c3d9801bfb1ce28fc24000954c73548fe09c52c0bad660eb10d963b0c60d5c5943ccf2c8292a8d957f2acb
languageName: node
linkType: hard

"source-map-resolve@npm:^0.5.0":
version: 0.5.3
resolution: "source-map-resolve@npm:0.5.3"
Expand Down

0 comments on commit 35bf47a

Please sign in to comment.