gistfile1.txt 我觉得我们建立工程的第一步 是生成一个package.json 写好需要的依赖和版本 然后直接 npm i 一次全部安装好开发所所需要的全部环境。保存和复用package.json是提高效率的好方法
我觉得我们建立工程的第一步 是生成一个package.json 写好需要的依赖和版本 然后直接 npm i 一次全部安装好开发所所需要的全部环境。保存和复用package.json是提高效率的好方法。 npm脚本指令执行script项目中配置的shell指令 除了下面的情况 还是老老实实的npm run .. 如下,这一块也是可以复用的 npm start是npm run start npm stop是npm run stop的简写 npm test是npm run test的简写 npm restart是npm run stop && npm run restart && npm run start的简写 例子很多: "scripts": { "build": "./node_modules/webpack/bin/webpack.js -p", "dev-server": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --content-base build/", "test": "echo \"Error: no test specified\" && exit 1" }, 一般我用 "scripts": { "start": "webpack-dev-server --hot --inline --colors --content-base ./build", "build": "webpack --progress --colors" } 补充一个点: npm改用国内的淘宝源来下载 npm config edit 看一下 你的registry的默认值,不要用默认的,改成我的就能用 registry=https://registry.npm.taobao.org/ 还有一个有意思的指令 cnpm 淘宝出的 $ npm install -g cnpm --registry=https://registry.npm.taobao.org 安装完成后,以后所有的插件便可以使用cnpm这个命令来进行安装。 比如 $ cnpm install -g cordova ionic可以复用的package.json 带了rxjs
{ "name": "rxjs-example", "version": "1.0.0", "description": "", "main": "index.html", "scripts": { "build": "./node_modules/webpack/bin/webpack.js -p", "dev-server": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --content-base build/", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "devDependencies": { "autoprefixer": "^6.4.1", "babel-cli": "^6.26.0", "babel-core": "^6.14.0", "babel-loader": "^6.2.5", "babel-preset-es2015": "^6.14.0", "babel-preset-stage-0": "^6.5.0", "clean-webpack-plugin": "^0.1.10", "css-loader": "^0.23.1", "exports-loader": "^0.6.3", "expose-loader": "^0.7.1", "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.9.0", "html-webpack-plugin": "^2.24.1", "postcss-cssnext": "^2.8.0", "postcss-import": "^8.1.2", "postcss-loader": "^0.9.1", "postcss-reporter": "^1.4.1", "style-loader": "^0.13.1", "url-loader": "^0.5.7", "webpack": "^1.13.1", "webpack-dev-server": "^1.16.2" }, "dependencies": { "@reactivex/rxjs": "^5.0.0-rc.3", "es6-promise": "^3.2.1", "jquery": "^3.1.1", "normalize.css": "^5.0.0", "nprogress": "^0.2.0", "rx": "^4.1.0", "rxjs": "^5.0.0-rc.3" } }