Skip to content

Commit

Permalink
Enable code splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz committed Oct 16, 2023
1 parent a36492e commit e3ea969
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
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",
"./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,
});

0 comments on commit e3ea969

Please sign in to comment.