瀏覽代碼

fix: fix npm build error

vben 4 年之前
父節點
當前提交
a3b7a6537a
共有 2 個文件被更改,包括 8 次插入8 次删除
  1. 7 7
      build/script/build.ts
  2. 1 1
      package.json

+ 7 - 7
build/script/build.ts

@@ -1,6 +1,6 @@
 // #!/usr/bin/env node
 
-import { sh } from 'tasksfile';
+// import { sh } from 'tasksfile';
 
 import { argv } from 'yargs';
 import { runBuildConfig } from './buildConf';
@@ -11,12 +11,12 @@ import { startGzipStyle } from '../plugin/gzip/compress';
 export const runBuild = async () => {
   try {
     const argvList = argv._;
-    let cmd = `cross-env NODE_ENV=production vite build`;
-    // await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);
-    await sh(cmd, {
-      async: true,
-      nopipe: true,
-    });
+    // let cmd = `cross-env NODE_ENV=production vite build`;
+    // // await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);
+    // await sh(cmd, {
+    //   async: true,
+    //   nopipe: true,
+    // });
 
     // Generate configuration file
     if (!argvList.includes('no-conf')) {

+ 1 - 1
package.json

@@ -4,7 +4,7 @@
   "scripts": {
     "bootstrap": "yarn install",
     "serve": "cross-env ts-node --files -P  ./build/tsconfig.json ./build/script/preserve && cross-env NODE_ENV=development vite",
-    "build": "node ./build/jsc.ts build",
+    "build": "cross-env NODE_ENV=production vite build && node ./build/jsc.ts build",
     "build:site": "cross-env SITE=true npm run build ",
     "build:no-cache": "yarn  clean:cache && node ./build/jsc.ts build",
     "report": "cross-env REPORT=true npm run build ",