-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.library.ts
109 lines (107 loc) · 2.67 KB
/
vite.library.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import { resolve } from "path";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import eslint from "vite-plugin-eslint";
import Inspect from "vite-plugin-inspect";
import svgr from "vite-plugin-svgr";
export default defineConfig(() => {
return {
plugins: [
react(),
svgr(),
eslint({
fix: true,
failOnError: false
}),
dts({ insertTypesEntry: true }),
Inspect({
build: false,
outputDir: ".vite-inspect"
})
],
define: {
"process.env": process.env,
global: "window",
__vite_process_env_NODE_ENV: JSON.stringify(process.env.NODE_ENV)
},
resolve: {
alias: {
"@demo/assets": resolve(__dirname, "./src/assets"),
"@demo/core": resolve(__dirname, "./src/core"),
"@demo/atomicui": resolve(__dirname, "./src/atomicui"),
"@demo/hooks": resolve(__dirname, "./src/hooks"),
"@demo/services": resolve(__dirname, "./src/services"),
"@demo/stores": resolve(__dirname, "./src/stores"),
"@demo/types": resolve(__dirname, "./src/types"),
"@demo/theme": resolve(__dirname, "./src/theme"),
"@demo/utils": resolve(__dirname, "./src/utils"),
"@demo/locales": resolve(__dirname, "./src/locales"),
"./runtimeConfig": "./runtimeConfig.browser"
}
},
build: {
outDir: "./lib",
sourcemap: false,
minify: true,
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: "DemoLib",
formats: ["es"],
fileName: (format, name) => `${name}.${format}.js`
},
rollupOptions: {
emptyOutDir: true,
external: [
/* Core deps */
"@aws-amplify/ui-react",
"@aws-sdk/client-cognito-identity",
"@@aws-sdk/client-geo-places",
"@aws-sdk/client-geo-routes",
"@aws-sdk/client-iot",
"@aws-sdk/client-location",
"@aws-sdk/client-pinpoint",
"@aws-sdk/credential-providers",
"@aws/amazon-location-utilities-auth-helper",
"@turf/turf",
"aws-amplify",
"aws-iot-device-sdk-v2",
"date-fns",
"i18next",
"i18next-browser-languagedetector",
"maplibre-gl-draw-circle",
"maplibre-gl",
"ngeohash",
"ramda",
"react",
"react-device-detect",
"react-dom",
"react-i18next",
"react-map-gl",
"react-router-dom",
"react-spring-bottom-sheet",
"react-toastify",
"react-tooltip",
"zustand",
/* Other deps */
"react/jsx-runtime",
"zustand/middleware",
"@turf/distance",
"@mapbox/mapbox-gl-draw",
"react/jsx-dev-runtime",
"mapbox-gl",
"styled-components"
],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM"
}
}
}
},
server: {
port: 3000
}
};
});