Skip to content

Commit 9739305

Browse files
committed
build: Disable side-effects for any ./debug-build.ts file
1 parent 9c7c6bf commit 9739305

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dev-packages/rollup-utils/npmHelpers.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
2626

2727
const packageDotJSON = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }));
2828

29+
const ignoreSideEffects = [/[\\\/]debug-build\.ts$/];
30+
2931
export function makeBaseNPMConfig(options = {}) {
3032
const {
3133
entrypoints = ['src/index.ts'],
@@ -83,6 +85,12 @@ export function makeBaseNPMConfig(options = {}) {
8385
interop: 'esModule',
8486
},
8587

88+
treeshake: {
89+
moduleSideEffects: (id, external) => {
90+
return external === false && ignoreSideEffects.some(regex => regex.test(id));
91+
}
92+
},
93+
8694
plugins: [nodeResolvePlugin, sucrasePlugin, debugBuildStatementReplacePlugin, rrwebBuildPlugin, cleanupPlugin],
8795

8896
// don't include imported modules from outside the package in the final output

0 commit comments

Comments
 (0)