Skip to content

Commit 6460cbe

Browse files
committed
fix: update stubs
1 parent 28ef521 commit 6460cbe

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

rollup.config.mjs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ const banner = `/*!
3232
// ensure TS checks only once for each build
3333
let hasTSChecked = false
3434

35-
const stubs = {
36-
[`dist/${name}.cjs`]: `${name}.cjs.js`,
37-
[`dist/${name}.mjs`]: `${name}.esm-bundler.js`,
38-
[`dist/${name}.runtime.mjs`]: `${name}.runtime.esm-bundler.js`,
39-
[`dist/${name}.prod.cjs`]: `${name}.cjs.prod.js`
35+
function resolveStubs(name, ns = '') {
36+
return {
37+
[`dist/${ns}${name}.cjs`]: `${ns}${name}.cjs.js`,
38+
[`dist/${ns}${name}.mjs`]: `${ns}${name}.esm-bundler.js`,
39+
[`dist/${ns}${name}.runtime.mjs`]: `${ns}${name}.runtime.esm-bundler.js`,
40+
[`dist/${ns}${name}.prod.cjs`]: `${ns}${name}.cjs.prod.js`
41+
}
4042
}
4143

4244
function resolveOutputConfigs(name, ns = '') {
@@ -102,6 +104,9 @@ if (name === 'vue-i18n-core') {
102104
]
103105
}
104106

107+
let stubs = resolveStubs(name)
108+
stubs = Object.assign({}, stubs, resolveStubs(name, 'petite-'))
109+
105110
if (process.env.NODE_ENV === 'production') {
106111
packageFormats.forEach(format => {
107112
if (packageOptions.prod === false) {
@@ -153,12 +158,9 @@ function createConfig(format, _output, plugins = []) {
153158
process.env.__DEV__ === 'false' || /\.prod\.[cm]?js$/.test(output.file)
154159
const isBundlerESMBuild = /mjs/.test(format)
155160
const isBrowserESMBuild = /browser/.test(format)
156-
// const isNodeBuild = format === 'cjs' || format === 'cjs-lite'
157-
const isNodeBuild =
158-
output.file.includes('.node.') || format === 'cjs' || format === 'cjs-lite'
161+
const isNodeBuild = output.file.includes('.node.') || format === 'cjs'
159162
const isGlobalBuild = /global/.test(format)
160163
const isRuntimeOnlyBuild = /runtime/.test(format)
161-
// const isLite = /petite-vue-i18n/.test(name)
162164
const isLite = /petite-vue-i18n/.test(output.file)
163165

164166
if (isGlobalBuild) {

0 commit comments

Comments
 (0)