wip: fix compiler dep externalization

This commit is contained in:
Evan You 2021-05-05 11:05:53 -04:00
parent 5278e0622a
commit b14de6c3f8

View File

@ -91,6 +91,7 @@ function createConfig(format, output, plugins = []) {
const isNodeBuild = format === 'cjs' const isNodeBuild = format === 'cjs'
const isGlobalBuild = /global/.test(format) const isGlobalBuild = /global/.test(format)
const isCompatBuild = !!packageOptions.compat const isCompatBuild = !!packageOptions.compat
const isCompatPackage = pkg.name === '@vue/compat'
if (isGlobalBuild) { if (isGlobalBuild) {
output.name = packageOptions.name output.name = packageOptions.name
@ -121,7 +122,7 @@ function createConfig(format, output, plugins = []) {
// the compat build needs both default AND named exports. This will cause // the compat build needs both default AND named exports. This will cause
// Rollup to complain for non-ESM targets, so we use separate entries for // Rollup to complain for non-ESM targets, so we use separate entries for
// esm vs. non-esm builds. // esm vs. non-esm builds.
if (isCompatBuild && (isBrowserESMBuild || isBundlerESMBuild)) { if (isCompatPackage && (isBrowserESMBuild || isBundlerESMBuild)) {
entryFile = /runtime$/.test(format) entryFile = /runtime$/.test(format)
? `src/esm-runtime.ts` ? `src/esm-runtime.ts`
: `src/esm-index.ts` : `src/esm-index.ts`
@ -129,7 +130,7 @@ function createConfig(format, output, plugins = []) {
let external = [] let external = []
if (isGlobalBuild || isBrowserESMBuild || isCompatBuild) { if (isGlobalBuild || isBrowserESMBuild || isCompatPackage) {
if (!packageOptions.enableNonBrowserBranches) { if (!packageOptions.enableNonBrowserBranches) {
// normal browser builds - non-browser only imports are tree-shaken, // normal browser builds - non-browser only imports are tree-shaken,
// they are only listed here to suppress warnings. // they are only listed here to suppress warnings.