使用NPM node js Typescript加快构建过程

时间:2018-12-27 07:16:48

标签: node.js typescript npm

我试图将我的json文件作为数据加载到typescript模块中。因此,我已使用以下行加载了该文件:import * as data from "my.json"

但是我遇到了与javascript堆内存有关的错误。因此,找到了一个使用以下软件包的解决方案:increase-memory-limit

我尝试运行该程序,但是现在花费了太多时间。即使我已经等了一个小时,仍然什么也没有。这是我正在使用的package.json文件:

{
  "name": "deep-playground-prototype",
  "version": "2016.3.10",
  "description": "",
  "private": true,
  "scripts": {
    "fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit",
    "clean": "rimraf dist",
    "start": "npm run serve-watch",
    "prep": "copyfiles analytics.js dist && concat node_modules/material-design-lite/material.min.js node_modules/seedrandom/seedrandom.min.js > dist/lib.js",
    "build-css": "concat node_modules/material-design-lite/material.min.css styles.css > dist/bundle.css",
    "watch-css": "concat node_modules/material-design-lite/material.min.css styles.css -o dist/bundle.css",
    "build-html": "copyfiles index.html dist",
    "watch-html": "concat index.html -o dist/index.html",
    "build-js": "browserify src/playground.ts -p [tsify] | uglifyjs -c > dist/bundle.js",
    "watch-js": "watchify src/playground.ts -p [tsify] -v --debug -o dist/bundle.js",
    "build": "npm run prep && npm run build-js && npm run build-css && npm run build-html",
    "watch": "npm run prep && concurrently \"npm run watch-js\" \"npm run watch-css\" \"npm run watch-html\"",
    "serve": "http-server -o -c-1 dist/",
    "serve-watch": "concurrently \"http-server -o -c-1 dist/\" \"npm run watch\""
  },
  "devDependencies": {
    "@types/d3": "^3.5.34",
    "@types/jquery": "^3.3.28",
    "concat": "^1.0.3",
    "concurrently": "3.1.0",
    "copyfiles": "1.0.0",
    "http-server": "^0.11.1",
    "rimraf": "2.5.4",
    "tsify": "^4.0.0",
    "typescript": "^2.9",
    "uglify-js": "^2.8.29",
    "watchify": "^3.11.0"
  },
  "dependencies": {
    "cross-env": "^5.2.0",
    "d3": "^3.5.16",
    "jquery": "^3.3.1",
    "material-design-lite": "^1.3.0",
    "seedrandom": "^2.4.3"
  }
}

我尝试使用以下命令构建js和css:

npm run build

我只停留在生产线上,没有任何其他事情发生。让我知道如何解决这个耗时的过程。我需要一个聪明的解决方案,希望有聪明的人在这里为您提供帮助。有没有人?

0 个答案:

没有答案