diff --git a/packages/compiler-core/src/utils.ts b/packages/compiler-core/src/utils.ts index 0c922304..69725085 100644 --- a/packages/compiler-core/src/utils.ts +++ b/packages/compiler-core/src/utils.ts @@ -60,7 +60,7 @@ let _parse: typeof parse let _walk: typeof walk export function loadDep(name: string) { - if (typeof process !== 'undefined' && isFunction(require)) { + if (!__BROWSER__ && typeof process !== 'undefined' && isFunction(require)) { return require(name) } else { // This is only used when we are building a dev-only build of the compiler diff --git a/rollup.config.js b/rollup.config.js index 81971c33..b2a66d14 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -114,7 +114,7 @@ function createConfig(output, plugins = []) { createReplacePlugin( isProductionBuild, isBundlerESMBuild, - (isGlobalBuild || isRawESMBuild) && + (isGlobalBuild || isRawESMBuild || isBundlerESMBuild) && !packageOptions.enableNonBrowserBranches, isRuntimeCompileBuild ),