Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add production build for esm-browser #2939

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const packageConfigs = packageBuilds.map((format) =>
packageBuilds.forEach((buildName) => {
if (buildName === 'cjs') {
packageConfigs.push(createProductionConfig(buildName))
} else if (buildName === 'global') {
} else if (buildName === 'global' || buildName === 'browser') {
packageConfigs.push(createMinifiedConfig(buildName))
}
})
Expand All @@ -99,7 +99,7 @@ function createConfig(buildName, output, plugins = []) {

const isProductionBuild = /\.prod\.[cm]?js$/.test(output.file)
const isGlobalBuild = buildName === 'global'
const isRawESMBuild = buildName === 'browser'
const isRawESMBuild = buildName.includes('browser')
const isNodeBuild = buildName === 'cjs'
const isBundlerESMBuild = buildName === 'browser' || buildName === 'mjs'

Expand All @@ -125,7 +125,8 @@ function createConfig(buildName, output, plugins = []) {
// during a single build.
hasTSChecked = true

const external = ['vue', '@vue/devtools-api']
const external = ['vue']
if (buildName !== 'browser-prod') external.push('@vue/devtools-api')

const nodePlugins = [nodeResolve(), commonjs()]

Expand Down Expand Up @@ -219,9 +220,9 @@ function createProductionConfig(format) {

function createMinifiedConfig(format) {
return createConfig(
format,
format === 'browser' ? 'browser-prod' : format,
{
file: `dist/${name}.${format === 'global' ? 'iife' : format}.prod.js`,
file: `dist/${name}.${format === 'browser' ? 'esm-browser' : format === 'global' ? 'iife' : format}.prod.js`,
format: outputConfigs[format].format,
},
[
Expand Down