Skip to content
Merged
Changes from 3 commits
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
8 changes: 8 additions & 0 deletions dev-packages/rollup-utils/npmHelpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));

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

const ignoreSideEffects = /[\\\/]debug-build\.ts$/;

export function makeBaseNPMConfig(options = {}) {
const {
entrypoints = ['src/index.ts'],
Expand Down Expand Up @@ -83,6 +85,12 @@ export function makeBaseNPMConfig(options = {}) {
interop: 'esModule',
},

treeshake: {
moduleSideEffects: (id, external) => {
return external === false && ignoreSideEffects.test(id);
}
},

plugins: [nodeResolvePlugin, sucrasePlugin, debugBuildStatementReplacePlugin, rrwebBuildPlugin, cleanupPlugin],

// don't include imported modules from outside the package in the final output
Expand Down
Loading