我用下面的項目,該項目使用的WebPack https://github.com/Hashnode/mern-starter如何使用的WebPack
我想部署它(正式版)我得到錯誤
錯誤部署MERN項目:找不到模塊」 ./dist/ manifest.json' 這個錯誤來自https://github.com/Hashnode/mern-starter/blob/master/index.js
但我沒有看到項目中的dist文件夾,爲什麼,我應該如何構建它?
我相信Dist文件夾應該在構建時間(manification等)創建,所以我應該如何觸發它?
這是的package.json
{
"name": "mern-starter",
"version": "2.0.0",
"description": "Boilerplate project for building Isomorphic apps using React and Redux",
"scripts": {
"test": "cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/mern-test node_modules/.bin/nyc node --harmony-proxies node_modules/.bin/ava",
"watch:test": "npm run test -- --watch",
"cover": "nyc npm run test",
"check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
"start": "cross-env BABEL_DISABLE_CACHE=1 NODE_ENV=development nodemon index.js",
"start:prod": "cross-env NODE_ENV=production node index.js",
"bs": "npm run clean && npm run build && npm run build:server && npm run start:prod",
"build": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js",
"build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js",
"clean": "rimraf dist",
"slate": "rimraf node_modules && npm install",
"lint": "eslint client server"
},
我認爲開始:PROD應該觸發它在的WebPack但 它不是happing ...任何想法?
你怎麼想deply:
開始生產版本應通過
npm run start:prod
(cross-env NODE_ENV=production node index.js
或從的package.json文件複製命令)來完成?您是否使用'npm run bs'作爲文檔建議? – UnholySheep@UnholySheep - 謝謝,不,我沒有做到這一點,但讓我現在檢查,讓你知道......順便說一句,我可以模擬本地?我的意思是運行創建dist等的過程? –
那麼,這就是'npm run bs'應該做的(通過'npm run build'和'npm run build:server'調用它)。 – UnholySheep