Skip to content

Commit caf5d69

Browse files
authored
fix: use global as mf format external type (#331)
fix: use global as mf format external type (#331)
1 parent 3a68db0 commit caf5d69

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/core/src/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,10 @@ const composeExternalsConfig = (
656656
esm: 'module-import',
657657
cjs: 'commonjs',
658658
umd: 'umd',
659-
mf: 'var', // same as default value
659+
// If use 'var', when projects import an external package like '@pkg', this will cause a syntax error such as 'var pkg = @pkg'.
660+
// If use 'umd', the judgement conditions may be affected by other packages that define variables like 'define'.
661+
// Therefore, we use 'global' to satisfy both web and node environments.
662+
mf: 'global',
660663
} as const;
661664

662665
switch (format) {

0 commit comments

Comments
 (0)