Skip to content

Commit dfbd289

Browse files
committed
feat: better browser/native import conditions
1 parent 877fadb commit dfbd289

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

bundler/bundle.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@ export const build = async (...files) => {
435435
: JSON.stringify(x, null, 1).replaceAll(/^ *(".+")(,?)$/gmu, (_, s, c) => `${wrap(s)}${c}`)
436436
}
437437

438-
const isNative =
439-
process.env.EXODUS_TEST_IS_BAREBONE || process.env.EXODUS_TEST_PLATFORM === 'workerd'
438+
const isBrowser = process.env.EXODUS_TEST_IS_BROWSER // browsers, electron renderer, servo
439+
const isNative = process.env.EXODUS_TEST_IS_BAREBONE
440440
const config = {
441441
logLevel: 'silent',
442442
stdin: {
@@ -446,9 +446,9 @@ export const build = async (...files) => {
446446
bundle: true,
447447
outdir: options.outdir,
448448
entryNames: filename,
449-
platform: isNative ? 'neutral' : 'browser',
450-
conditions: isNative ? ['react-native'] : ['browser'],
451-
mainFields: ['browser', 'module', 'main'], // FIXME: Removing 'browser' breaks some pkgs
449+
platform: isBrowser ? 'browser' : 'neutral',
450+
conditions: isBrowser ? ['browser'] : isNative ? ['react-native'] : [],
451+
mainFields: isBrowser || isNative ? ['browser', 'module', 'main'] : ['module', 'main'],
452452
define: {
453453
'process.browser': stringify(true),
454454
'process.emitWarning': 'undefined',

0 commit comments

Comments
 (0)