Skip to content

Commit fdbb22e

Browse files
authored
fix: make browser the default target (#1633)
* fix: make browser the default target * fix: make browser the default target * fix: make browser the default target * chore: adjust core changes
1 parent 0d660ad commit fdbb22e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

commands/build/lib/config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ const getExternalDefault = ({ pkg }) => {
5353
return Object.keys(peers);
5454
};
5555

56+
const getExternalCore = ({ pkg }) => {
57+
const defaultExternal = ['@nebula.js/stardust', /^@qlik\/api\//];
58+
const peers = Object.keys(pkg.peerDependencies || {});
59+
return [...defaultExternal, ...peers];
60+
};
61+
5662
const getOutputFileDefault = ({ pkg }) => pkg.main;
5763

5864
const getOutputNameDefault = ({ pkg }) => pkg.name.split('/').reverse()[0];
@@ -105,7 +111,7 @@ const config = ({
105111
}
106112
}
107113

108-
const external = getExternal({ pkg, config: argv });
114+
const external = core ? getExternalCore({ pkg }) : getExternal({ pkg, config: argv });
109115
// stardust should always be external
110116
if (external.indexOf('@nebula.js/stardust') === -1) {
111117
// eslint-disable-next-line no-console
@@ -128,7 +134,7 @@ const config = ({
128134
} else {
129135
outputConfig.dir = path.resolve(dir, outputFile.split('/')[0]);
130136
}
131-
if (argv.codeSplit && format === 'umd') {
137+
if (format === 'umd') {
132138
outputConfig.inlineDynamicImports = true;
133139
}
134140
return outputConfig;

commands/build/lib/init-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const options = {
5252
description:
5353
'In Rollup, the browser option is a configuration option that specifies whether the bundle is intended to run in a browser environment.',
5454
type: 'boolean',
55-
default: false,
55+
default: true,
5656
},
5757
codeSplit: {
5858
description:

0 commit comments

Comments
 (0)