Skip to content

Commit a0b8146

Browse files
committed
Use global React in UMD build
1 parent 51742db commit a0b8146

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

scripts/release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (process.cwd() !== resolvePath(__dirname, '..')) {
1919
// is a "pre-release" if nextVersion is premajor, preminor,
2020
// prepatch, or prerelease
2121
const nextVersion = prompt(`Next version (current version is ${getPackageVersion()})? `)
22-
const isPrerelease = nextVersion.substring(0, 3) === 'pre' || nextVersion.indexOf('-') !== -1
22+
const isPrerelease = nextVersion.substr(0, 3) === 'pre' || nextVersion.indexOf('-') !== -1
2323

2424
// 1) Make sure the tests pass
2525
exec('npm test -- --single-run')

webpack.config.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
const webpack = require('webpack')
22

33
module.exports = {
4-
54
output: {
65
library: 'ReactRouter',
76
libraryTarget: 'umd'
87
},
98

9+
externals: {
10+
react: {
11+
root: 'React',
12+
commonjs2: 'react',
13+
commonjs: 'react',
14+
amd: 'react'
15+
}
16+
},
17+
1018
module: {
1119
loaders: [
1220
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' }
@@ -18,5 +26,4 @@ module.exports = {
1826
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
1927
})
2028
]
21-
2229
}

0 commit comments

Comments
 (0)