Skip to content

Commit 882a37a

Browse files
author
Zack Argyle
committed
Fix build to exclude React dependencies
1 parent cd0f1dc commit 882a37a

File tree

2 files changed

+38
-28
lines changed

2 files changed

+38
-28
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"eslint-plugin-jsx-a11y": "^1.2.3",
4646
"eslint-plugin-react": "^5.1.1",
4747
"mocha": "^2.2.5",
48+
"react": "^0.14.8",
4849
"react-addons-test-utils": "^15.1.0",
4950
"rimraf": "^2.5.2",
5051
"sinon": "^1.17.4",

webpack.config.js

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,46 @@
1-
'use strict';
1+
var webpack = require('webpack');
22

3-
var webpack = require('webpack')
3+
var reactExternal = {
4+
root: 'React',
5+
commonjs2: 'react',
6+
commonjs: 'react',
7+
amd: 'react'
8+
};
49

5-
var env = process.env.NODE_ENV
10+
var env = process.env.NODE_ENV;
611
var config = {
7-
module: {
8-
loaders: [
9-
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }
12+
externals: {
13+
react: reactExternal
14+
},
15+
module: {
16+
loaders: [
17+
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }
18+
]
19+
},
20+
output: {
21+
library: 'ReactBash',
22+
libraryTarget: 'umd'
23+
},
24+
plugins: [
25+
new webpack.optimize.OccurrenceOrderPlugin(),
26+
new webpack.DefinePlugin({
27+
'process.env.NODE_ENV': JSON.stringify(env)
28+
})
1029
]
11-
},
12-
output: {
13-
library: 'ReactBash',
14-
libraryTarget: 'umd'
15-
},
16-
plugins: [
17-
new webpack.optimize.OccurrenceOrderPlugin(),
18-
new webpack.DefinePlugin({
19-
'process.env.NODE_ENV': JSON.stringify(env)
20-
})
21-
]
2230
};
2331

2432
if (env === 'production') {
25-
config.plugins.push(
26-
new webpack.optimize.UglifyJsPlugin({
27-
compressor: {
28-
pure_getters: true,
29-
unsafe: true,
30-
unsafe_comps: true,
31-
warnings: false
32-
}
33-
})
34-
)
33+
config.plugins.push(
34+
new webpack.optimize.UglifyJsPlugin({
35+
compressor: {
36+
pure_getters: true,
37+
unsafe: true,
38+
unsafe_comps: true,
39+
screw_ie8: true,
40+
warnings: false
41+
}
42+
})
43+
)
3544
}
3645

37-
module.exports = config
46+
module.exports = config;

0 commit comments

Comments
 (0)