Skip to content

Commit db35c7c

Browse files
committed
umd fix
1 parent 4c7a3f4 commit db35c7c

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

package.json

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"babel-eslint": "^7.2.3",
2828
"babel-jest": "^20.0.3",
2929
"babel-loader": "^7.0.0",
30+
"babel-plugin-add-module-exports": "^0.2.1",
3031
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
3132
"babel-preset-es2015": "^6.24.1",
3233
"babel-preset-react": "^6.24.1",
@@ -57,9 +58,9 @@
5758
"start": "export NODE_ENV=development && webpack-dev-server -d --content-base ./app --hot --inline ./app/app.js",
5859
"mkdir:dist": "mkdir -p dist",
5960
"version": "npm run build",
60-
"build:lib": "babel index.js -o ./dist/react-prelodr.js --ignore 'test.js' --ignore 'app.js'",
61-
"build:min": "webpack --progress --colors -p index.js dist/react-prelodr.min.js",
62-
"build": "export NODE_ENV=production && npm run mkdir:dist && npm run build:lib && npm run build:min",
61+
"build:lib": "export NODE_ENV=commonjs && babel index.js -o ./dist/react-prelodr.js --ignore 'test.js' --ignore 'app.js'",
62+
"build:min": "export NODE_ENV=umd && webpack --progress --colors -p index.js dist/react-prelodr.min.js",
63+
"build": "npm run mkdir:dist && npm run build:lib && npm run build:min",
6364
"lint": "eslint src",
6465
"test": "export NODE_ENV=testing && npm run lint && jest --coverage",
6566
"coverage": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
@@ -78,7 +79,7 @@
7879
"react"
7980
]
8081
},
81-
"production": {
82+
"commonjs": {
8283
"presets": [
8384
[
8485
"es2015",
@@ -93,6 +94,22 @@
9394
"transform-es2015-modules-commonjs"
9495
]
9596
},
97+
"umd": {
98+
"presets": [
99+
[
100+
"es2015",
101+
{
102+
"modules": false
103+
}
104+
],
105+
"stage-0",
106+
"react"
107+
],
108+
"plugins": [
109+
"add-module-exports",
110+
"transform-es2015-modules-commonjs"
111+
]
112+
},
96113
"development": {
97114
"presets": [
98115
[

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,10 @@ babel-messages@^6.23.0:
449449
dependencies:
450450
babel-runtime "^6.22.0"
451451

452+
babel-plugin-add-module-exports@^0.2.1:
453+
version "0.2.1"
454+
resolved "https://registry.yarnpkg.com/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-0.2.1.tgz#9ae9a1f4a8dc67f0cdec4f4aeda1e43a5ff65e25"
455+
452456
babel-plugin-check-es2015-constants@^6.22.0:
453457
version "6.22.0"
454458
resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a"

0 commit comments

Comments
 (0)