Skip to content

Commit 9a1fcbc

Browse files
committed
fix: output dist files
1 parent 74bbb8d commit 9a1fcbc

File tree

2 files changed

+21
-33
lines changed

2 files changed

+21
-33
lines changed

scripts/build-rolldown.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ async function main() {
129129
rolldown(c).then(bundle => {
130130
return bundle.write(c.output as OutputOptions).then(() => {
131131
// @ts-expect-error
132-
return path.join('packages', target, c.output.file)
132+
return path.join(
133+
'packages',
134+
target,
135+
'dist',
136+
path.basename(c.output.file)
137+
)
133138
})
134139
})
135140
)

scripts/rolldown.ts

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function createConfigsForPackage({
4747
const name = path.basename(packageDir)
4848

4949
const banner = `/*!
50-
* ${name} v${pkg.version}
50+
* ${pkg.name} v${pkg.version}
5151
* (c) 2016-present ${pkg.author.name} and contributors
5252
* Released under the ${pkg.license} License.
5353
*/`
@@ -64,41 +64,40 @@ export function createConfigsForPackage({
6464

6565
const outputConfigs: Record<string, OutputOptions> = {
6666
mjs: {
67-
file: `dist/${name}.mjs`,
67+
file: resolve(`dist/${name}.mjs`),
6868
format: `es`
6969
},
7070
'mjs-node': {
71-
file: `dist/${name}.node.mjs`,
71+
file: resolve(`dist/${name}.node.mjs`),
7272
format: `es`
7373
},
7474
browser: {
75-
file: `dist/${name}.esm-browser.js`,
75+
file: resolve(`dist/${name}.esm-browser.js`),
7676
format: `es`
7777
},
7878
cjs: {
79-
// file: `dist/${name}.cjs.js`,
80-
file: `dist/${name}.cjs`,
79+
file: resolve(`dist/${name}.cjs`),
8180
format: `cjs`
8281
},
8382
global: {
84-
file: `dist/${name}.global.js`,
83+
file: resolve(`dist/${name}.global.js`),
8584
format: `iife`
8685
},
8786
// runtime-only builds, for '@intlify/core' and 'vue-i18n' package only
8887
'mjs-runtime': {
89-
file: `dist/${name}.runtime.mjs`,
88+
file: resolve(`dist/${name}.runtime.mjs`),
9089
format: `es`
9190
},
9291
'mjs-node-runtime': {
93-
file: `dist/${name}.runtime.node.mjs`,
92+
file: resolve(`dist/${name}.runtime.node.mjs`),
9493
format: `es`
9594
},
9695
'browser-runtime': {
97-
file: `dist/${name}.runtime.esm-browser.js`,
96+
file: resolve(`dist/${name}.runtime.esm-browser.js`),
9897
format: 'es'
9998
},
10099
'global-runtime': {
101-
file: `dist/${name}.runtime.global.js`,
100+
file: resolve(`dist/${name}.runtime.global.js`),
102101
format: 'iife'
103102
}
104103
}
@@ -155,7 +154,7 @@ export function createConfigsForPackage({
155154
const isRuntimeOnlyBuild = /runtime/.test(format)
156155
const isLite = /petite-vue-i18n/.test(name)
157156

158-
output.dir = resolve('dist')
157+
// output.dir = resolve('dist')
159158
output.sourcemap = sourceMap
160159
output.banner = banner
161160
output.externalLiveBindings = false
@@ -182,16 +181,6 @@ export function createConfigsForPackage({
182181
const defines: Record<string, string> = {
183182
__COMMIT__: `"${commit}"`,
184183
__VERSION__: `'${masterVersion}'`,
185-
/*
186-
__DEV__:
187-
['vue-i18n', 'petite-vue-i18n'].includes(name) && isNodeBuild
188-
? 'false' // tree-shake devtools
189-
: isBundlerESMBuild
190-
? // preserve to be handled by bundlers
191-
`(process.env.NODE_ENV !== 'production')`
192-
: // hard coded dev/prod builds
193-
!isProductionBuild,
194-
*/
195184
// this is only used during Vue's internal tests
196185
__TEST__: `false`,
197186
// If the build is expected to run directly in the browser (global / esm builds)
@@ -226,14 +215,6 @@ export function createConfigsForPackage({
226215
__FEATURE_DROP_MESSAGE_COMPILER__: isBundlerESMBuild
227216
? `__INTLIFY_DROP_MESSAGE_COMPILER__`
228217
: `false`
229-
// ...(isProductionBuild && isBrowserESMBuild
230-
// ? {
231-
// 'emitError(': `/*#__PURE__*/ emitError(`,
232-
// 'createCompileError(': `/*#__PURE__*/ createCompileError(`,
233-
// 'throw createCoreError(': `throw Error(`,
234-
// 'throw createI18nError(': `throw Error(`
235-
// }
236-
// : {})
237218
}
238219

239220
if (!isBundlerESMBuild) {
@@ -337,7 +318,7 @@ export function createConfigsForPackage({
337318
const extension = format === 'cjs' || format === 'mjs' ? format : 'js'
338319
const descriptor = format === 'cjs' || format === 'mjs' ? '' : `.${format}`
339320
return createConfig(format, {
340-
file: `dist/${name}${descriptor}.prod.${extension}`,
321+
file: resolve(`dist/${name}${descriptor}.prod.${extension}`),
341322
format: outputConfigs[format].format
342323
})
343324
}
@@ -346,7 +327,9 @@ export function createConfigsForPackage({
346327
return createConfig(
347328
format,
348329
{
349-
file: String(outputConfigs[format].file).replace(/\.js$/, '.prod.js'),
330+
file: resolve(
331+
String(outputConfigs[format].file).replace(/\.js$/, '.prod.js')
332+
),
350333
format: outputConfigs[format].format
351334
},
352335
[

0 commit comments

Comments
 (0)