migrate to vite for build

This commit is contained in:
takeyuichi
2025-03-08 10:49:43 +09:00
parent 444e976b93
commit ba6826c0b7
3 changed files with 47 additions and 0 deletions
+2
View File
@@ -8,6 +8,7 @@
"start": "storybook dev -p 6006",
"build:demo": "webpack --mode production --config ./webpack/demo.config.js",
"build:plugin": "webpack --mode production --config ./webpack/plugin.config.js",
"build": "vite build",
"type": "yarn tsc src/*.ts --declaration --emitDeclarationOnly --outDir build --skipLibCheck",
"prepare": "yarn dev && yarn build:plugin && yarn type",
"gh": "yarn build:demo && gh-pages -d demo",
@@ -66,6 +67,7 @@
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"typescript": "^5.6.3",
"vite": "^6.2.1",
"vitest": "^3.0.7",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
+34
View File
@@ -0,0 +1,34 @@
import { defineConfig } from "vite";
// import react from '@vitejs/plugin-react';
// import path from 'path';
const path = require("path");
export default defineConfig({
// plugins: [react()],
build: {
outDir: "dist",
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: "ChartjsPluginStacked100",
// fileName: "index.js",
fileName: () => `index.js`,
// fileName: (format) => `chartjs-plugin-stacked100.${format}.js`,
formats: ["umd"],
// formats: ['umd', 'es'],
},
rollupOptions: {
external: ["chart.js"],
// external: ['react', 'react-dom', 'chart.js'],
output: {
globals: {
// react: 'React',
// 'react-dom': 'ReactDOM',
"chart.js": "Chart",
},
},
},
},
// server: {
// port: 3000,
// },
});
+11
View File
@@ -6428,6 +6428,17 @@ vite-node@3.0.7:
optionalDependencies:
fsevents "~2.3.3"
vite@^6.2.1:
version "6.2.1"
resolved "https://registry.yarnpkg.com/vite/-/vite-6.2.1.tgz#ae865d4bb93a11844be1bc647c8b2dd1856ea180"
integrity sha512-n2GnqDb6XPhlt9B8olZPrgMD/es/Nd1RdChF6CBD/fHW6pUyUTt2sQW2fPRX5GiD9XEa6+8A6A4f2vT6pSsE7Q==
dependencies:
esbuild "^0.25.0"
postcss "^8.5.3"
rollup "^4.30.1"
optionalDependencies:
fsevents "~2.3.3"
vitest@^3.0.7:
version "3.0.7"
resolved "https://registry.yarnpkg.com/vitest/-/vitest-3.0.7.tgz#ed8f42e1b0e09e2179eaefd966cb58a8b75f0f6a"