采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
已经将bundle.js编译出来了,但是刷新没效果,出现这个错误。麻烦老师解决一下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | var debug = process.env.NODE_ENV !== "production" ; var webpack = require( 'webpack' ); var path = require( 'path' ); module.exports = { context: path.join(__dirname), devtool: debug ? "inline-sourcemap" : null , entry: "./src/js/index.js" , module: { loaders: [ { test: /\.js?$/, exclude: /(node_modules)/, loader: 'babel-loader' , query: { presets: [ 'react' , 'es2015' ], plugins: [ 'react-html-attrs' ], //添加组件的插件配置 } }, //下面是使用 ant-design 的配置文件 { test: /\.css$/, loader: 'style-loader!css-loader' } ] }, output: { path: __dirname, filename: "./src/bundle.js" }, plugins: debug ? [] : [ new webpack.optimize.DedupePlugin(), new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin({ mangle: false , sourcemap: false }), ], }; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | { "name" : "react_form_new_to_old" , "version" : "1.0.0" , "description" : "" , "main" : "index.js" , "scripts" : { "test" : "echo \"Error: no test specified\" && exit 1" }, "author" : "" , "license" : "ISC" , "devDependencies" : { "babel-cli" : "^6.24.1" , "babel-preset-env" : "^1.4.0" , "source-map" : "^0.5.6" }, "dependencies" : { "babel-loader" : "^7.0.0" , "babel-preset-es2015" : "^6.24.1" , "babel-preset-react" : "^6.24.1" , "babelify" : "^7.3.0" , "react" : "^15.5.4" , "react-dom" : "^15.5.4" , "webpack" : "^2.5.1" , "webpack-dev-server" : "^2.4.5" } } |
老师,确实还是不行
登录后可查看更多问答,登录/注册
轻松入门 React 开发,React Router 4 与 Webpack 2 完美升级项目
了解课程