forked from react-grid-layout/react-grid-layout
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix duplicated react in webpack config
- Loading branch information
Showing
1 changed file
with
41 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} | ||
}; |