Commit a3b7a6537ae25af076fdcccb50dd6967f0def40b

Authored by vben
1 parent 5fb069f4

fix: fix npm build error

build/script/build.ts
1 // #!/usr/bin/env node 1 // #!/usr/bin/env node
2 2
3 -import { sh } from 'tasksfile'; 3 +// import { sh } from 'tasksfile';
4 4
5 import { argv } from 'yargs'; 5 import { argv } from 'yargs';
6 import { runBuildConfig } from './buildConf'; 6 import { runBuildConfig } from './buildConf';
@@ -11,12 +11,12 @@ import { startGzipStyle } from '../plugin/gzip/compress'; @@ -11,12 +11,12 @@ import { startGzipStyle } from '../plugin/gzip/compress';
11 export const runBuild = async () => { 11 export const runBuild = async () => {
12 try { 12 try {
13 const argvList = argv._; 13 const argvList = argv._;
14 - let cmd = `cross-env NODE_ENV=production vite build`;  
15 - // await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);  
16 - await sh(cmd, {  
17 - async: true,  
18 - nopipe: true,  
19 - }); 14 + // let cmd = `cross-env NODE_ENV=production vite build`;
  15 + // // await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);
  16 + // await sh(cmd, {
  17 + // async: true,
  18 + // nopipe: true,
  19 + // });
20 20
21 // Generate configuration file 21 // Generate configuration file
22 if (!argvList.includes('no-conf')) { 22 if (!argvList.includes('no-conf')) {
package.json
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 "scripts": { 4 "scripts": {
5 "bootstrap": "yarn install", 5 "bootstrap": "yarn install",
6 "serve": "cross-env ts-node --files -P ./build/tsconfig.json ./build/script/preserve && cross-env NODE_ENV=development vite", 6 "serve": "cross-env ts-node --files -P ./build/tsconfig.json ./build/script/preserve && cross-env NODE_ENV=development vite",
7 - "build": "node ./build/jsc.ts build", 7 + "build": "cross-env NODE_ENV=production vite build && node ./build/jsc.ts build",
8 "build:site": "cross-env SITE=true npm run build ", 8 "build:site": "cross-env SITE=true npm run build ",
9 "build:no-cache": "yarn clean:cache && node ./build/jsc.ts build", 9 "build:no-cache": "yarn clean:cache && node ./build/jsc.ts build",
10 "report": "cross-env REPORT=true npm run build ", 10 "report": "cross-env REPORT=true npm run build ",