Skip to content

Commit

Permalink
fix: make browser the default target (#1633)
Browse files Browse the repository at this point in the history
* fix: make browser the default target

* fix: make browser the default target

* fix: make browser the default target

* chore: adjust core changes
  • Loading branch information
Caele authored Oct 22, 2024
1 parent 0d660ad commit fdbb22e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions commands/build/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ const getExternalDefault = ({ pkg }) => {
return Object.keys(peers);
};

const getExternalCore = ({ pkg }) => {
const defaultExternal = ['@nebula.js/stardust', /^@qlik\/api\//];
const peers = Object.keys(pkg.peerDependencies || {});
return [...defaultExternal, ...peers];
};

const getOutputFileDefault = ({ pkg }) => pkg.main;

const getOutputNameDefault = ({ pkg }) => pkg.name.split('/').reverse()[0];
Expand Down Expand Up @@ -105,7 +111,7 @@ const config = ({
}
}

const external = getExternal({ pkg, config: argv });
const external = core ? getExternalCore({ pkg }) : getExternal({ pkg, config: argv });
// stardust should always be external
if (external.indexOf('@nebula.js/stardust') === -1) {
// eslint-disable-next-line no-console
Expand All @@ -128,7 +134,7 @@ const config = ({
} else {
outputConfig.dir = path.resolve(dir, outputFile.split('/')[0]);
}
if (argv.codeSplit && format === 'umd') {
if (format === 'umd') {
outputConfig.inlineDynamicImports = true;
}
return outputConfig;
Expand Down
2 changes: 1 addition & 1 deletion commands/build/lib/init-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const options = {
description:
'In Rollup, the browser option is a configuration option that specifies whether the bundle is intended to run in a browser environment.',
type: 'boolean',
default: false,
default: true,
},
codeSplit: {
description:
Expand Down

0 comments on commit fdbb22e

Please sign in to comment.