Skip to content

Commit d35ea7e

Browse files
committed
Fixes externals configuration for UMD build.
1 parent c79f283 commit d35ea7e

File tree

11 files changed

+107
-3361
lines changed

11 files changed

+107
-3361
lines changed

.babelrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"react"
1616
],
1717
"plugins": [
18-
"transform-class-properties"
18+
"transform-class-properties",
19+
"lodash"
1920
]
2021
},
2122
"umd": {
@@ -25,7 +26,8 @@
2526
"react"
2627
],
2728
"plugins": [
28-
"transform-class-properties"
29+
"transform-class-properties",
30+
"lodash"
2931
]
3032
}
3133
}

commonjs/MyComponent.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

commonjs/goodbyeWorld.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

commonjs/helloWorld.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

package-lock.json

Lines changed: 17 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"babel-eslint": "^7.2.3",
6262
"babel-jest": "^20.0.3",
6363
"babel-loader": "^7.0.0",
64+
"babel-plugin-lodash": "^3.2.11",
6465
"babel-plugin-transform-class-properties": "^6.24.1",
6566
"babel-polyfill": "^6.23.0",
6667
"babel-preset-env": "^1.5.2",
@@ -82,6 +83,7 @@
8283
"in-publish": "^2.0.0",
8384
"jest": "^20.0.4",
8485
"lint-staged": "^4.0.0",
86+
"lodash-webpack-plugin": "^0.11.4",
8587
"prettier": "^1.4.4",
8688
"prettier-eslint": "^6.3.0",
8789
"prettier-eslint-cli": "^4.1.1",

tools/webpack/configFactory.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { resolve as resolvePath } from 'path'
22
import webpack from 'webpack'
33
import appRootDir from 'app-root-dir'
4+
import LodashModuleReplacementPlugin from 'lodash-webpack-plugin'
45
import { getPackageJson, removeEmpty, ifElse } from '../utils'
56

67
function webpackConfigFactory({ target }) {
78
const libraryName = getPackageJson().name
89
const minimize = target === 'umd-min'
10+
const env = process.env.NODE_ENV
911

1012
return {
1113
entry: {
@@ -32,6 +34,18 @@ function webpackConfigFactory({ target }) {
3234
commonjs: 'react-dom',
3335
commonjs2: 'react-dom',
3436
},
37+
'prop-types': {
38+
root: 'PropTypes',
39+
amd: 'prop-types',
40+
commonjs: 'prop-types',
41+
commonjs2: 'prop-types',
42+
},
43+
'react-sizeme': {
44+
root: 'SizeMe',
45+
commonjs2: 'react-sizeme',
46+
commonjs: 'react-sizeme',
47+
amd: 'react-sizeme',
48+
},
3549
},
3650
plugins: removeEmpty([
3751
new webpack.DefinePlugin({
@@ -57,6 +71,7 @@ function webpackConfigFactory({ target }) {
5771
},
5872
}),
5973
),
74+
ifElse(env === 'production')(new LodashModuleReplacementPlugin()),
6075
]),
6176
module: {
6277
rules: [

umd/npm-library-starter.js

Lines changed: 0 additions & 183 deletions
This file was deleted.

umd/npm-library-starter.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)