答案 0 :(得分:1)
如果你还没有创建一个package.json文件,那么如果你创建一个并且有这样的代码块就会很好:
$('#select1').on('change',function(){
if ($('#select1').val() == 'Red') {
$('#elements .anElement').hide().filter('[color*="'Red' "]').show();
}
...
您可以删除未使用的模块。
然后运行:{
"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"
]
}
}
它将在端口8080上运行
如果在没有package.json的情况下启动dev服务器。 您可以直接从终端运行以下内容。
npm start