-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathvite.config.lib.ts
57 lines (56 loc) · 1.86 KB
/
vite.config.lib.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { resolve } from "path";
import { defineConfig } from "vite";
import pkg from "./package.json";
import baseConfig from "./vite.config";
// https://vitejs.dev/config/
export default Object.assign(
baseConfig,
defineConfig({
build: {
outDir: "lib",
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, "src/index.ts"),
name: "VueLive",
// the proper extensions will be added
fileName: "vue-live",
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [
...Object.keys(pkg.dependencies),
// make sure jsx schema is loaded from external
"prismjs/components/prism-clike.js",
"prismjs/components/prism-markup.js",
"prismjs/components/prism-javascript.js",
"prismjs/components/prism-typescript.js",
"prismjs/components/prism-jsx.js",
"prismjs/components/prism-css.js",
"@vue/compiler-core/dist/compiler-core.cjs",
"@vue/compiler-dom/dist/compiler-dom.cjs",
"@vue/compiler-dom",
"vue",
],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: "Vue",
prismjs: "PrismJs",
acorn: "Acorn",
"hash-sum": "Hash",
"vue-inbrowser-compiler-sucrase": "VueInBrowserCompilerSucrase",
"vue-inbrowser-prismjs-highlighter": "VueInBrowserPrismjsHighlighter",
"@vue/compiler-core": "VueCompilerCore",
"@vue/compiler-dom": "VueCompilerDom",
"acorn-walk": "AcornWalk",
"vue-prism-editor": "VuePrismEditor",
"debounce": "Debounce",
},
exports: "named",
},
},
},
})
);