Skip to content

Commit

Permalink
Fix duplicated react in webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
STRML committed Aug 5, 2015
1 parent 5215b62 commit 0d366bc
Showing 1 changed file with 41 additions and 38 deletions.
79 changes: 41 additions & 38 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
'use strict';
var webpack = require('webpack');
var webpack = require("webpack");

// Builds bundle usable <script>. Includes RGL and all deps, excluding React.
module.exports = {
context: __dirname,
entry: {
'react-grid-layout': './index-dev.js'
},
output: {
path: __dirname + "/dist",
filename: "[name].min.js",
libraryTarget: "umd",
library: "ReactGridLayout"
},
devtool: 'source-map',
externals: {
// React dep should be available as window.React
"react": "React",
"react/addons": "React"
},
module: {
loaders: [
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?stage=0'}
]
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
// See #40 - duplicated React modules don't play nice
new webpack.NormalModuleReplacementPlugin(/\/react\/lib\/cloneWithProps/, '../../react-clonewithprops/index.js'),
// Compress, but don't print warnings to console
new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}})
],
resolve: {
extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx"]
context: __dirname,
entry: {
"react-grid-layout": "./index-dev.js"
},
output: {
path: __dirname + "/dist",
filename: "[name].min.js",
libraryTarget: "umd",
library: "ReactGridLayout"
},
devtool: "source-map",
externals: {
"react": {
"commonjs": "react",
"commonjs2": "react",
"amd": "react",
// React dep should be available as window.React, not window.react
"root": "React"
}
},
module: {
loaders: [
{test: /\.jsx?$/, exclude: /node_modules/, loader: "babel-loader?stage=0"}
]
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
// See #40 - duplicated React modules don't play nice
new webpack.NormalModuleReplacementPlugin(/\/react\/lib\/cloneWithProps/, "../../react-clonewithprops/index.js"),
// Compress, but don't print warnings to console
new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}})
],
resolve: {
extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx"]
}
};

0 comments on commit 0d366bc

Please sign in to comment.