-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
41 lines (40 loc) · 1.49 KB
/
vite.config.js
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
import path from "path";
import { defineConfig } from "vite";
export default defineConfig({
build: {
minify: false,
outDir: "dist",
lib: {
name: "OpenfeedSDKJS",
entry: path.resolve(__dirname, "src/index.ts"),
},
rollupOptions: {
/**
* Explanation to bundler what packages are expected to be EXTERNAL
* aka from project that uses this library
*
* We added peer dependency to our package.json
* NOTE: that we need to keep versions same, otherwise we will have two "same" libraries
* we can avoid this by putting "*" as version in peer dependencies
* overall that makes more confusion and stuff mostly break when developer upgrades major version of package
*/
input: path.resolve(__dirname, "src/index.ts"),
output: [
// bundle and export singular files (in case somebody wants to import single component)
{
entryFileNames: ({ name }) => `${name}.js`,
format: "esm",
dir: "dist",
// preserveModules: true,
},
],
},
},
resolve: {
alias: {
"@src": path.resolve(process.cwd(), "src"),
"@gen": path.resolve(process.cwd(), "generated"),
os: path.resolve(process.cwd(), "src/utilities/empty.ts"),
},
},
});