mirror of
https://github.com/ethan-zf/cesium-plot-js.git
synced 2025-06-24 03:27:29 +00:00
Build code according to environment variables, specifying port and auto-opening of the page.
This commit is contained in:
parent
ed5c21dacb
commit
cc031e04b9
@ -4,8 +4,8 @@
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"dev": "vite --mode dev",
|
||||
"build": "vite build --mode prod",
|
||||
"lint": "eslint . --ext ts --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
|
@ -1,12 +1,31 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { defineConfig } from 'vite';
|
||||
import { resolve } from 'path';
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
return {
|
||||
base: "./",
|
||||
define: {
|
||||
"process.env": {
|
||||
NODE_ENV: mode,
|
||||
let config = {};
|
||||
if (mode === 'dev') {
|
||||
config = {
|
||||
base: './',
|
||||
define: {
|
||||
'process.env': {
|
||||
NODE_ENV: mode,
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
server: {
|
||||
port: 3001,
|
||||
open: true,
|
||||
},
|
||||
};
|
||||
} else if (mode === 'prod') {
|
||||
config = {
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'src/index.ts'),
|
||||
name: 'CesiumPlot',
|
||||
fileName: 'CesiumPlot',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
return config;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user