var debug = process.env.NODE_ENV !== "production"; var webpack = require('webpack'); var path = require('path'); module.exports = { entry: "./src/js/root.js", context: path.join(__dirname), devtool: debug ? "inline-sourcemap" : null, output: { // path: __dirname, filename: "./src/bundle.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' } ] }, plugins: debug ? [] : [ new webpack.optimize.DedupePlugin(), new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }), ], externals: { //don't bundle the 'react' npm package with our bundle.js //but get it from a global 'React' variable 'react': 'React' }, resolve: { extensions: ['', '.js', '.jsx'], modulesDirectories: ["./src", "node_modules", "bower_components"] } };
想问一个react 的问题,不知道是哪里错了。改了无数次都没用,路径看着也没毛病。但是换了别人的node_module就可以了。重新安装新的插件就又这样,
有谁可以帮忙看看?
ruibin