Skip to content

Commit 56104ad

Browse files
committed
Prebuild production version
1 parent 152e9b8 commit 56104ad

File tree

2 files changed

+46
-18
lines changed

2 files changed

+46
-18
lines changed

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,18 @@
3030
"sideEffects": false,
3131
"exports": {
3232
".": {
33-
"import": "./dist/index.js",
34-
"require": "./dist/index.cjs"
33+
"import": {
34+
"types": "./dist/index.d.ts",
35+
"production:": "./dist/prod/index.js",
36+
"development:": "./dist/index.js",
37+
"default": "./dist/index.js"
38+
},
39+
"require": {
40+
"types": "./dist/index.d.cts",
41+
"production:": "./dist/prod/index.cjs",
42+
"development:": "./dist/index.cjs",
43+
"default": "./dist/index.cjs"
44+
}
3545
}
3646
},
3747
"main": "dist/index.js",

tsup.config.ts

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
1+
import type { Options } from 'tsup'
12
import GlobalsPlugin from 'esbuild-plugin-globals'
23
import { defineConfig } from 'tsup'
34

4-
export default defineConfig({
5-
target: 'node12',
6-
globalName: 'FluentVue',
7-
splitting: true,
8-
esbuildPlugins: [
9-
GlobalsPlugin({
10-
'vue-demi': 'VueDemi',
11-
'@fluent/bundle': 'FluentBundle',
12-
}),
13-
],
14-
external: ['vue-demi', '@fluent/bundle', '@vue/devtools-api'],
15-
entry: ['src/index.ts', 'src/composition.ts'],
16-
format: ['esm', 'cjs', 'iife'],
17-
dts: true,
18-
clean: true,
19-
})
5+
function getConfig(overrides: Partial<Options> = {}): Options {
6+
return {
7+
target: 'node16',
8+
globalName: 'FluentVue',
9+
splitting: true,
10+
esbuildPlugins: [
11+
GlobalsPlugin({
12+
'vue-demi': 'VueDemi',
13+
'@fluent/bundle': 'FluentBundle',
14+
}),
15+
],
16+
external: ['vue-demi', '@fluent/bundle', '@vue/devtools-api'],
17+
entry: ['src/index.ts', 'src/composition.ts'],
18+
format: ['esm', 'cjs', 'iife'],
19+
...overrides,
20+
}
21+
}
22+
23+
export default defineConfig([
24+
getConfig({
25+
clean: true,
26+
dts: true,
27+
outDir: 'dist',
28+
}),
29+
getConfig({
30+
clean: false,
31+
dts: false,
32+
env: {
33+
NODE_ENV: 'production',
34+
},
35+
outDir: 'dist/prod',
36+
}),
37+
])

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy