File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 55 "license" : " MIT" ,
66 "description" : " Easily configurable React components for animations / transitions 💃" ,
77 "repository" : " https://github.com/Setsun/react-transition-components" ,
8- "module " : " src /index.js" ,
9- "main " : " dist/index.js" ,
8+ "main " : " dist/node /index.js" ,
9+ "browser " : " dist/index.js" ,
1010 "types" : " dist/types/index.d.ts" ,
1111 "engines" : {
1212 "npm" : " ^6.0.0"
2020 ],
2121 "scripts" : {
2222 "start" : " cross-env NODE_ENV=development webpack --config webpack.config.js --watch" ,
23- "build" : " cross-env NODE_ENV=production webpack --config webpack.config.js && tsc" ,
23+ "build" : " cross-env npm run build:browser && npm run build:node && tsc" ,
24+ "build:browser" : " cross-env NODE_ENV=production webpack --config webpack.config.js" ,
25+ "build:node" : " cross-env NODE_ENV=production TARGET_ENV=node webpack --config webpack.config.js" ,
2426 "test" : " jest src/*" ,
2527 "typecheck" : " tsc --noEmit --jsx react src/*" ,
2628 "typegen" : " tsc" ,
Original file line number Diff line number Diff line change @@ -3,14 +3,18 @@ const path = require('path');
33const src = path . resolve ( __dirname , 'src' ) ;
44const dist = path . resolve ( __dirname , 'dist' ) ;
55
6+ const isNode = process . env . TARGET_ENV === 'node' ;
7+ const target = isNode ? 'node' : 'web' ;
8+ const filename = isNode ? 'node/index.js' : 'index.js' ;
9+
610module . exports = {
711 mode : 'production' ,
8- target : 'web' ,
12+ target : target ,
913 context : src ,
1014 entry : 'index.ts' ,
1115 output : {
1216 path : dist ,
13- filename : 'index.js' ,
17+ filename : filename ,
1418 publicPath : '/' ,
1519 libraryTarget : 'umd' ,
1620 } ,
You can’t perform that action at this time.
0 commit comments