2016-12-14 197 views

回答

1

如果您尚未創建的package.json文件,這將是好,如果你做一個,並有這樣的代碼塊:

{ 
    "name": "someName", 
    "description": "description", 
    "main": "index.js", 
    "scripts": { 
    "start": "webpack-dev-server --host 0.0.0.0 --port 8080 --devtool eval --progress --colors", 
    "build": "NODE_ENV=production webpack --config webpack.config.prod.js -p" 
    }, 
    "dependencies": { 
    "babel-polyfill": "^6.16.0", 
    "html-webpack-plugin": "^2.24.1", 
    "react": "^15.3.2", 
    "react-dom": "^15.3.2", 
    "react-router": "^3.0.0", 
    "redux": "^3.6.0" 
    }, 
    "devDependencies": { 
    "babel-core": "^6.17.0", 
    "babel-loader": "^6.2.5", 
    "babel-preset-es2015": "^6.16.0", 
    "babel-preset-react": "^6.16.0", 
    "webpack": "^1.13.2", 
    "webpack-dev-server": "^1.16.2" 
    }, 
    "babel": { 
    "presets": [ 
     "es2015", 
     "react" 
    ], 
    "plugins": [ 
     "transform-runtime", 
     "transform-object-rest-spread" 
    ] 
    } 
} 

您可以刪除未使用的模塊。 然後運行:npm start ,如果你開始你的開發服務器沒有的package.json它將在端口8080

運行。 你可以簡單地從終端運行以下。

webpack-dev-server --host 0.0.0.0 --port 8080 
相關問題