Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.

Commit b779eef

Browse files
committed
feat: setup Babel plugin transform-imports
This plugin will transform your imports to only import specific components, which ensures not the whole library gets included. This is preconfigured to handle: lodash, reactstrap, react-bootstrap, react-router. See <https://www.npmjs.com/package/babel-plugin-transform-imports> for additional information.
1 parent b490094 commit b779eef

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

app/templates/_package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"babel-eslint": "^8.2.2",
6363
"babel-loader": "^7.1.4",
6464
"babel-plugin-syntax-dynamic-import": "^6.18.0",
65+
"babel-plugin-transform-imports": "^1.5.0",
6566
"babel-plugin-transform-object-rest-spread": "^6.26.0",
6667
"babel-plugin-transform-regenerator": "^6.26.0",
6768
"babel-plugin-transform-runtime": "^6.23.0",

app/templates/babelrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@
1616
"generators": true,
1717
"async": true
1818
}
19+
],
20+
[
21+
"transform-imports",
22+
{
23+
"lodash": {
24+
"transform": "lodash/${member}",
25+
"preventFullImport": true
26+
},
27+
"reactstrap": {
28+
"transform": "reactstrap/lib/${member}",
29+
"preventFullImport": true
30+
},
31+
"react-bootstrap": {
32+
"transform": "react-bootstrap/lib/${member}",
33+
"preventFullImport": true
34+
},
35+
"react-router": {
36+
"transform": "react-router/${member}",
37+
"preventFullImport": true
38+
}
39+
}
1940
]
2041
]
2142
}

0 commit comments

Comments
 (0)