Przeglądaj źródła

build: esm-bunlder builds should be considered browser builds

Evan You 6 lat temu
rodzic
commit
9550302df4
2 zmienionych plików z 2 dodań i 2 usunięć
  1. 1 1
      packages/compiler-core/src/utils.ts
  2. 1 1
      rollup.config.js

+ 1 - 1
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

+ 1 - 1
rollup.config.js

@@ -114,7 +114,7 @@ function createConfig(output, plugins = []) {
       createReplacePlugin(
         isProductionBuild,
         isBundlerESMBuild,
-        (isGlobalBuild || isRawESMBuild) &&
+        (isGlobalBuild || isRawESMBuild || isBundlerESMBuild) &&
           !packageOptions.enableNonBrowserBranches,
         isRuntimeCompileBuild
       ),