diff --git a/build/lib/util.js b/build/lib/util.js index 3eae325612a..bc2a8fff5c7 100644 --- a/build/lib/util.js +++ b/build/lib/util.js @@ -302,7 +302,8 @@ function acquireWebNodePaths() { for (const key of Object.keys(webPackages)) { const packageJSON = path.join(root, 'node_modules', key, 'package.json'); const packageData = JSON.parse(fs.readFileSync(packageJSON, 'utf8')); - let entryPoint = packageData.browser ?? packageData.main; + // Only cases where the browser is a string are handled + let entryPoint = typeof packageData.browser === 'string' ? packageData.browser : packageData.main; // On rare cases a package doesn't have an entrypoint so we assume it has a dist folder with a min.js if (!entryPoint) { // TODO @lramos15 remove this when jschardet adds an entrypoint so we can warn on all packages w/out entrypoint diff --git a/build/lib/util.ts b/build/lib/util.ts index bbe6c52ef41..0818ebfb75d 100644 --- a/build/lib/util.ts +++ b/build/lib/util.ts @@ -371,7 +371,8 @@ export function acquireWebNodePaths() { for (const key of Object.keys(webPackages)) { const packageJSON = path.join(root, 'node_modules', key, 'package.json'); const packageData = JSON.parse(fs.readFileSync(packageJSON, 'utf8')); - let entryPoint: string = packageData.browser ?? packageData.main; + // Only cases where the browser is a string are handled + let entryPoint: string = typeof packageData.browser === 'string' ? packageData.browser : packageData.main; // On rare cases a package doesn't have an entrypoint so we assume it has a dist folder with a min.js if (!entryPoint) {