Skip to content

Commit

Permalink
feat: vite preview
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Jan 24, 2021
1 parent 2eb2d2a commit c1a4600
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 405 deletions.
33 changes: 0 additions & 33 deletions build/script/preview.ts

This file was deleted.

21 changes: 0 additions & 21 deletions build/utils.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,14 @@
import fs from 'fs';
import path from 'path';
import { networkInterfaces } from 'os';
import dotenv from 'dotenv';
import chalk from 'chalk';
// import execa from 'execa';

export const isFunction = (arg: unknown): arg is (...args: any[]) => any =>
typeof arg === 'function';

export const isRegExp = (arg: unknown): arg is RegExp =>
Object.prototype.toString.call(arg) === '[object RegExp]';

/**
* get client ip address
*/
export function getIPAddress() {
let interfaces = networkInterfaces();
for (let devName in interfaces) {
let iFace = interfaces[devName];
if (!iFace) return;
for (let i = 0; i < iFace.length; i++) {
let alias = iFace[i];
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
return alias.address;
}
}
}

return '';
}

export function isDevFn(mode: string): boolean {
return mode === 'development';
}
Expand Down
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"build": "cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts",
"build:no-cache": "yarn clean:cache && npm run build",
"report": "cross-env REPORT=true npm run build ",
"preview": "npm run build && esno ./build/script/preview.ts",
"preview:dist": "esno ./build/script/preview.ts",
"preview": "npm run build && vite preview",
"preview:dist": "vite preview",
"log": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite",
"clean:lib": "npx rimraf node_modules",
Expand All @@ -22,7 +22,7 @@
"dependencies": {
"@iconify/iconify": "^2.0.0-rc.6",
"@vueuse/core": "^4.0.10",
"ant-design-vue": "^2.0.0-rc.9",
"ant-design-vue": "2.0.0-rc.8",
"apexcharts": "^3.23.1",
"axios": "^0.21.1",
"crypto-es": "^1.2.6",
Expand All @@ -48,7 +48,7 @@
"@commitlint/config-conventional": "^11.0.0",
"@iconify/json": "^1.1.290",
"@ls-lint/ls-lint": "^1.9.2",
"@purge-icons/generated": "^0.5.2",
"@purge-icons/generated": "^0.6.0",
"@types/echarts": "^4.9.3",
"@types/fs-extra": "^9.0.6",
"@types/http-proxy": "^1.17.5",
Expand Down Expand Up @@ -81,11 +81,8 @@
"esno": "^0.4.0",
"fs-extra": "^9.1.0",
"husky": "^4.3.8",
"koa": "^2.13.1",
"koa-static": "^5.0.0",
"less": "^4.1.0",
"lint-staged": "^10.5.3",
"portfinder": "^1.0.28",
"postcss": "^8.2.4",
"postcss-import": "^14.0.0",
"prettier": "^2.2.1",
Expand All @@ -98,10 +95,10 @@
"stylelint-order": "^4.1.0",
"ts-node": "^9.1.1",
"typescript": "^4.1.3",
"vite": "2.0.0-beta.44",
"vite": "2.0.0-beta.47",
"vite-plugin-html": "^2.0.0-beta.6",
"vite-plugin-mock": "^2.0.0-rc.2",
"vite-plugin-purge-icons": "^0.5.2",
"vite-plugin-purge-icons": "^0.6.0",
"vite-plugin-pwa": "^0.3.10",
"vite-plugin-style-import": "^0.4.6",
"vue-eslint-parser": "^7.4.1",
Expand Down
10 changes: 0 additions & 10 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,12 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
drop_console: VITE_DROP_CONSOLE,
},
},
// minify: 'esbuild',
rollupOptions: {
output: {
compact: true,
manualChunks: undefined,
},
},
minify: 'esbuild',
commonjsOptions: {
ignore: [
// xlsx
'fs',
'crypto',
'stream',
],
},
},
define: {
__VERSION__: pkg.version,
Expand Down
Loading

0 comments on commit c1a4600

Please sign in to comment.