Skip to content

Commit 164c96d

Browse files
committed
feat: follow workerd import condition under workerd
1 parent e2db0aa commit 164c96d

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

bundler/bundle.js

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

438-
const isBrowser = process.env.EXODUS_TEST_IS_BROWSER // browsers, electron renderer, servo
439-
const isNative = process.env.EXODUS_TEST_IS_BAREBONE
438+
const conditions = []
439+
if (process.env.EXODUS_TEST_PLATFORM === 'workerd') {
440+
conditions.push('workerd')
441+
} else if (process.env.EXODUS_TEST_IS_BROWSER) {
442+
// browsers, electron renderer, servo
443+
conditions.push('browser')
444+
} else if (process.env.EXODUS_TEST_IS_BAREBONE) {
445+
conditions.push('react-native')
446+
}
447+
440448
const config = {
441449
logLevel: 'silent',
442450
stdin: {
@@ -446,8 +454,8 @@ export const build = async (...files) => {
446454
bundle: true,
447455
outdir: options.outdir,
448456
entryNames: filename,
449-
platform: isBrowser ? 'browser' : 'neutral',
450-
conditions: isBrowser ? ['browser'] : isNative ? ['react-native'] : [],
457+
platform: process.env.EXODUS_TEST_IS_BROWSER ? 'browser' : 'neutral',
458+
conditions,
451459
mainFields: ['browser', 'module', 'main'], // FIXME: Removing 'browser' breaks some pkgs
452460
define: {
453461
'process.browser': stringify(true),

0 commit comments

Comments
 (0)