Skip to content

Commit 6d2a140

Browse files
committed
Don't build constant as external module
1 parent bbaa26f commit 6d2a140

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

Diff for: rollup.config.js

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
import createRollupConfig from '@guanghechen/rollup-config'
22
import path from 'path'
33

4-
async function rollupConfig() {
4+
const internalModules = new Set(['@algorithm.ts/constant'])
5+
6+
export default async function rollupConfig() {
57
const { default: manifest } = await import(path.resolve('package.json'))
6-
const config = createRollupConfig({
8+
const configs = createRollupConfig({
79
manifest,
810
pluginOptions: {
911
typescriptOptions: { tsconfig: 'tsconfig.src.json' },
1012
},
1113
})
12-
return config
13-
}
1414

15-
export default rollupConfig()
15+
configs.forEach(config => {
16+
if (config.external) {
17+
const external = config.external
18+
// eslint-disable-next-line no-param-reassign
19+
config.external = function (id) {
20+
if (internalModules.has(id)) return false
21+
return external(id)
22+
}
23+
}
24+
})
25+
return configs
26+
}

0 commit comments

Comments
 (0)