Skip to content

Commit 6f56815

Browse files
committed
workflow: add build-preview command
1 parent f4c4548 commit 6f56815

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"dev": "vite",
3434
"build": "vite build",
3535
"build-types": "vue-tsc -p tsconfig.build.json && api-extractor run -c api-extractor.json && node scripts/cleanup.js",
36+
"build-preview": "vite build -c vite.preview.config.ts",
3637
"format": "prettier --write .",
3738
"release": "bumpp -r",
3839
"prepublishOnly": "npm run build && npm run build-types"

vite.config.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { defineConfig, Plugin } from 'vite'
2-
import vue from '@vitejs/plugin-vue'
3-
import replace from '@rollup/plugin-replace'
1+
import { defineConfig, Plugin, UserConfig } from 'vite'
2+
import base from './vite.preview.config'
43

54
const genStub: Plugin = {
65
name: 'gen-stub',
@@ -15,7 +14,8 @@ const genStub: Plugin = {
1514
}
1615

1716
export default defineConfig({
18-
plugins: [vue(), genStub],
17+
...base,
18+
plugins: [...(base as UserConfig).plugins! , genStub],
1919
optimizeDeps: {
2020
// avoid late discovered deps
2121
include: [
@@ -28,22 +28,6 @@ export default defineConfig({
2828
'vue/server-renderer',
2929
],
3030
},
31-
resolve: {
32-
alias: {
33-
path: 'path-browserify',
34-
},
35-
},
36-
worker: {
37-
format: 'es',
38-
plugins: [
39-
replace({
40-
preventAssignment: true,
41-
values: {
42-
'process.env.NODE_ENV': JSON.stringify('production'),
43-
},
44-
}),
45-
],
46-
},
4731
base: './',
4832
build: {
4933
target: 'esnext',

vite.preview.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { defineConfig } from 'vite'
2+
import vue from '@vitejs/plugin-vue'
3+
import replace from '@rollup/plugin-replace'
4+
5+
export default defineConfig({
6+
plugins: [vue()],
7+
resolve: {
8+
alias: {
9+
path: 'path-browserify',
10+
},
11+
},
12+
worker: {
13+
format: 'es',
14+
plugins: [
15+
replace({
16+
preventAssignment: true,
17+
values: {
18+
'process.env.NODE_ENV': JSON.stringify('production'),
19+
},
20+
}),
21+
],
22+
},
23+
})

0 commit comments

Comments
 (0)