Skip to content

Commit 9d5f18f

Browse files
committed
Improve build process to reduce package size
1 parent dee0fd7 commit 9d5f18f

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"serve": "vite --host",
88
"build": "npm run build:types && npm run build:lib",
99
"build:lib": "vite build",
10-
"build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir lib_types -p tsconfig.build.json",
10+
"build:types": "vue-tsc --declaration --emitDeclarationOnly --declarationMap false --outDir lib_types -p tsconfig.build.json",
1111
"typecheck": "vue-tsc --noEmit",
1212
"lint": "eslint .",
1313
"lint:fix": "npm run lint --fix",
@@ -23,16 +23,15 @@
2323
"exports": {
2424
".": {
2525
"types": "./lib_types/hy-vue-gantt.d.ts",
26-
"import": "./lib/hy-vue-gantt.js",
27-
"require": "./lib/hy-vue-gantt.umd.cjs"
26+
"import": "./lib/hy-vue-gantt.js"
2827
}
2928
},
30-
"main": "./lib/hy-vue-gantt.umd.cjs",
29+
"main": "./lib/hy-vue-gantt.js",
30+
"module": "./lib/hy-vue-gantt.js",
3131
"types": "./lib_types/hy-vue-gantt.d.ts",
3232
"files": [
33-
"lib_types",
34-
"lib/hy-vue-gantt.js",
35-
"lib/hy-vue-gantt.umd.cjs"
33+
"lib_types/**/*.d.ts",
34+
"lib/hy-vue-gantt.js"
3635
],
3736
"devDependencies": {
3837
"@eslint/compat": "^1.2.3",

vite.config.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,30 @@ export default () => {
4040
? {
4141
entry: fileURLToPath(new URL("src/hy-vue-gantt.ts", import.meta.url)),
4242
name: "HyVueGantt",
43-
fileName: "hy-vue-gantt"
43+
fileName: "hy-vue-gantt",
44+
formats: ["es"]
4445
}
4546
: undefined,
4647
outDir: process.env.NODE_ENV === "production" ? "lib" : "dist",
48+
copyPublicDir: process.env.NODE_ENV !== "production",
4749
rollupOptions: {
4850
external: [
4951
"vue",
52+
/^vue\//,
5053
"dayjs",
54+
/^dayjs/,
5155
"date-holidays",
52-
/^dayjs\/plugin/,
53-
/^dayjs\/locale/,
54-
"@fortawesome/vue-fontawesome",
55-
"@fortawesome/free-solid-svg-icons",
56-
"@vueuse/core",
56+
/^@fortawesome/,
57+
/^@vueuse/,
5758
"html2canvas",
5859
"jspdf",
59-
"lodash-es",
60+
/^lodash/,
6061
"uuid",
61-
"xlsx"
62+
"xlsx",
63+
"papaparse"
6264
],
6365
output: {
64-
// Provide global variables to use in the UMD build
65-
// for externalized deps
6666
compact: true,
67-
globals: {
68-
vue: "Vue",
69-
dayjs: "dayjs",
70-
"date-holidays": "date-holidays",
71-
"lodash-es": "lodash-es",
72-
uuid: "uuid",
73-
html2canvas: "html2canvas",
74-
jspdf: "jspdf",
75-
xlsx: "xlsx"
76-
},
7767
exports: "named"
7868
},
7969
treeshake: {

0 commit comments

Comments
 (0)