add hw2
This commit is contained in:
54
node_modules/@zenuml/core/vite.config.lib.ts
generated
vendored
Normal file
54
node_modules/@zenuml/core/vite.config.lib.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/* eslint-env node */
|
||||
import { resolve } from "path";
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
|
||||
import svgr from "vite-plugin-svgr";
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
// Read version from package.json
|
||||
const packageJson = JSON.parse(
|
||||
readFileSync(resolve(__dirname, "package.json"), "utf-8"),
|
||||
);
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
// https://vitejs.dev/guide/build.html#library-mode
|
||||
lib: {
|
||||
entry: resolve(__dirname, "src/core.tsx"),
|
||||
// https://vitejs.dev/config/build-options.html#build-lib
|
||||
// the exposed global variable and is required when formats includes 'umd' or 'iife'.
|
||||
name: "ZenUML",
|
||||
fileName: "zenuml",
|
||||
},
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
output: [
|
||||
{
|
||||
format: "esm",
|
||||
// https://rollupjs.org/guide/en/#outputentryfilenames
|
||||
// It will use the file name in `build.lib.entry` without extension as `[name]` if `[name].xxx.yyy` is provided.
|
||||
// So we hard code as zenuml. We may consider rename `core.ts` to `zenuml.ts`.
|
||||
// If this field is not provided, result with be ${build.lib.filename}.esm.js.
|
||||
// Mermaid's build.ts output hardcoded esm file as '.mjs', thus we need this config.
|
||||
entryFileNames: `zenuml.esm.mjs`,
|
||||
},
|
||||
{
|
||||
name: "zenuml", // it is the global variable name representing your bundle. https://rollupjs.org/guide/en/#outputname
|
||||
format: "umd",
|
||||
entryFileNames: `zenuml.js`,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
plugins: [svgr(), react(), cssInjectedByJsPlugin()],
|
||||
define: {
|
||||
"process.env.NODE_ENV": '"production"',
|
||||
"process.env.VITE_VERSION": JSON.stringify(packageJson.version),
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user