Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enable code splitting
  • Loading branch information
Mrtenz committed Oct 16, 2023
commit befdf2daa0b83e3aa1568ab6eb8f7c3f4147a6ff
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"bugs": {
"url": "https://github.com/MetaMask/utils/issues"
},
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/utils.git"
Expand All @@ -19,8 +20,6 @@
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"dist"
Expand Down
1 change: 1 addition & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"./src/**/__tests__/**/*",
"./src/**/__snapshots__/**/*",
"./src/**/*.test.ts",
"./src/**/*.test-d.ts",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test-d.ts files were included in the dist folder before. I've added it to the excludes here and in tsup.config.ts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, good catch.

"./src/**/*.test.*.ts"
]
}
18 changes: 16 additions & 2 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ import { defineConfig } from 'tsup';

export default defineConfig({
// The entry to bundle.
entry: ['src/index.ts'],
entry: [
'src/**/*.ts',
'!src/**/__fixtures__/**/*',
'!src/**/__mocks__/**/*',
'!src/**/__test__/**/*',
'!src/**/__tests__/**/*',
'!src/**/__snapshots__/**/*',
'!src/**/*.test.ts',
'!src/**/*.test-d.ts',
'!src/**/*.test.*.ts',
],

// The output formats. We want to generate both CommonJS and ESM bundles.
// https://tsup.egoist.dev/#bundle-formats
Expand All @@ -18,9 +28,13 @@ export default defineConfig({
// Enables shimming of `__dirname` and `import.meta.url`, so that they work
// in both CommonJS and ESM.
// https://tsup.egoist.dev/#inject-cjs-and-esm-shims
shims: true,
shims: false,

// Hide unnecessary logs from the console. Warnings and errors will still be
// shown.
silent: true,

// Split the output into chunks. This is useful for tree-shaking.
// https://tsup.egoist.dev/#code-splitting
splitting: true,
});