Skip to content

Commit f2ee2fc

Browse files
committed
refactor: add vite settings for svelte, vue
1 parent 3ef57e1 commit f2ee2fc

File tree

17 files changed

+428
-265
lines changed

17 files changed

+428
-265
lines changed

packages/conveyer/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"karma-viewport": "^1.0.4",
7474
"mocha": "^6.0.2",
7575
"print-coveralls": "^1.2.2",
76-
"rollup-plugin-visualizer": "^6.0.3",
7776
"sinon": "^7.5.0",
7877
"terser": "^5.43.1",
7978
"ts-mock-imports": "^1.3.8",

packages/conveyer/vite.config.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// vite.config.ts
22
import { defineConfig } from "vite";
33
import path from "path";
4-
import { visualizer } from "rollup-plugin-visualizer";
54

65
const pkg = require("./package.json");
76

@@ -14,13 +13,6 @@ const banner = `/*!
1413
const format = process.env.VITE_BUILD_FORMAT;
1514

1615
export default defineConfig({
17-
plugins: [
18-
visualizer({
19-
sourcemap: true,
20-
filename: "./statistics/index.html",
21-
title: `${pkg.name} bundle stats`,
22-
}),
23-
],
2416
define: {
2517
"#__VERSION__#": JSON.stringify(pkg.version),
2618
"#__FILETYPE__#": JSON.stringify(format || "unknown"),

packages/react-conveyer/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"react": "^17.0.2",
4747
"react-dom": "^17.0.2",
4848
"react-scripts": "4.0.3",
49-
"rollup-plugin-visualizer": "^6.0.3",
5049
"terser": "^5.43.1",
5150
"typescript": "^4.1.2",
5251
"vite": "^7.1.3",

packages/react-conveyer/vite.config.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { defineConfig } from "vite";
22
import path from "path";
33
import react from "@vitejs/plugin-react";
44
import dts from "vite-plugin-dts";
5-
import { visualizer } from "rollup-plugin-visualizer";
65

76
const pkg = require("./package.json");
87

@@ -18,11 +17,6 @@ export default defineConfig({
1817
dts({
1918
insertTypesEntry: true,
2019
}),
21-
visualizer({
22-
sourcemap: true,
23-
filename: "./statistics/index.html",
24-
title: `${pkg.name} bundle stats`,
25-
}),
2620
],
2721
define: {
2822
"#__VERSION__#": JSON.stringify(pkg.version),

packages/svelte-conveyer/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@
4242
"scripts": {
4343
"dev": "rollup -c -w",
4444
"start": "sirv public --no-clear",
45-
"build": "rollup -c rollup.build.config.js && npm run declaration",
45+
"build": "vite build && npm run declaration",
4646
"declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json"
4747
},
4848
"devDependencies": {
4949
"@babel/core": "^7.12.10",
5050
"@babel/preset-env": "^7.12.11",
5151
"@egjs/build-helper": "0.0.5",
5252
"@pyoner/svelte-ts-preprocess": "^1.2.1",
53+
"@sveltejs/vite-plugin-svelte": "^6.1.3",
5354
"@testing-library/jest-dom": "^5.11.8",
5455
"@testing-library/svelte": "^3.0.3",
5556
"@types/jest": "^26.0.19",
@@ -64,10 +65,12 @@
6465
"sirv-cli": "^0.4.4",
6566
"svelte": "^3.31.0",
6667
"svelte-jester": "^1.3.0",
67-
"svelte-preprocess": "^4.6.1",
68+
"svelte-preprocess": "^4.10.7",
6869
"ts-jest": "^26.4.4",
6970
"tslib": "^1.10.0",
70-
"typescript": "^4.1.6"
71+
"typescript": "^4.1.6",
72+
"vite": "^7.1.3",
73+
"vite-plugin-dts": "^4.5.4"
7174
},
7275
"dependencies": {
7376
"@cfcs/svelte": "^0.1.0",

packages/svelte-conveyer/rollup.build.config.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/svelte-conveyer/rollup.config.js

Lines changed: 0 additions & 83 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { defineConfig } from "vite";
2+
import path from "path";
3+
import { svelte } from "@sveltejs/vite-plugin-svelte";
4+
import sveltePreprocess from "svelte-preprocess";
5+
import dts from "vite-plugin-dts";
6+
7+
const pkg = require("./package.json");
8+
9+
const banner = `/*!
10+
* ${pkg.name} v${pkg.version}
11+
* (c) ${new Date().getFullYear()} ${pkg.author}
12+
* @license ${pkg.license}
13+
*/`;
14+
15+
export default defineConfig({
16+
plugins: [
17+
svelte({
18+
preprocess: sveltePreprocess(),
19+
}),
20+
dts({
21+
insertTypesEntry: true,
22+
}),
23+
],
24+
define: {
25+
"#__VERSION__#": JSON.stringify(pkg.version),
26+
},
27+
build: {
28+
lib: {
29+
entry: path.resolve(__dirname, "src/svelte-conveyer/index.ts"),
30+
name: "SvelteConveyer",
31+
formats: ["es", "cjs"],
32+
fileName: (format) => `conveyer.${format === "es" ? "esm" : "cjs"}.js`,
33+
},
34+
sourcemap: true,
35+
rollupOptions: {
36+
external: [/^svelte/],
37+
output: {
38+
globals: {
39+
svelte: "Svelte",
40+
},
41+
banner,
42+
exports: "named",
43+
freeze: false,
44+
},
45+
},
46+
outDir: "dist",
47+
},
48+
});

packages/vue-conveyer/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"scripts": {
1818
"serve": "vue-cli-service serve",
1919
"lint": "vue-cli-service lint",
20-
"build": "rollup -c && npm run declaration && print-sizes ./dist ",
20+
"build": "vite build && npm run declaration && print-sizes ./dist ",
2121
"declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json"
2222
},
2323
"keywords": [
@@ -46,6 +46,7 @@
4646
"@egjs/build-helper": "^0.1.2",
4747
"@typescript-eslint/eslint-plugin": "^2.33.0",
4848
"@typescript-eslint/parser": "^2.33.0",
49+
"@vitejs/plugin-vue": "^6.0.1",
4950
"@vue/cli-plugin-babel": "^5.0.8",
5051
"@vue/cli-plugin-eslint": "^5.0.8",
5152
"@vue/cli-plugin-typescript": "^5.0.8",
@@ -57,6 +58,8 @@
5758
"eslint-plugin-vue": "^7.0.0-0",
5859
"print-sizes": "^0.1.0",
5960
"typescript": "^4.5.2",
61+
"vite": "^7.1.3",
62+
"vite-plugin-dts": "^4.5.4",
6063
"vue": "^3.2.21"
6164
}
6265
}

packages/vue-conveyer/rollup.config.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)