Skip to content

Commit

Permalink
Add es2015 modules export, build umd with rollup and remove generated…
Browse files Browse the repository at this point in the history
… code (#359)

* Remove generated code in lib and dist

Remove src out of the npm package.

* Add es2015 modules export

Remove babel-plugin-transform-runtime from the build as it is not
necessary and increases the output size for nothing.

* Use rollup instead of webpack for umd builds

Lightens the umd builds quite a bit:

    $ ll dist old
    dist:
    total 504
    -rw-r--r--  1 tusbar  staff   192K Aug 16 21:16 react-leaflet.js
    -rw-r--r--  1 tusbar  staff    50K Aug 16 21:16 react-leaflet.min.js

    old:
    total 600
    -rw-r--r--  1 tusbar  staff   263K Aug 16 21:11 react-leaflet.js
    -rw-r--r--  1 tusbar  staff    77K Aug 16 21:11 react-leaflet.min.js

* Use lodash-es for es and rollup builds

This was taken from react-redux. :)
  • Loading branch information
tusbar authored and PaulLeCam committed Aug 17, 2017
1 parent 84fc0a2 commit c4ef757
Show file tree
Hide file tree
Showing 46 changed files with 225 additions and 13,755 deletions.
40 changes: 32 additions & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
{
"presets": [
"es2015",
"react",
"stage-1"
],
"plugins": [
"dev-expression",
"lodash",
"transform-proto-to-assign",
"transform-runtime"
]
"transform-proto-to-assign"
],
"env": {
"development": {
"presets": [
["es2015", { "modules": "commonjs", "loose": true }],
"react",
"stage-1"
]
},
"rollup": {
"presets": [
["es2015", { "modules": false, "loose": true }],
"react",
"stage-1"
],
"plugins": [
"external-helpers",
"./build/use-lodash-es"
]
},
"jsnext": {
"presets": [
["es2015", { "modules": false, "loose": true }],
"react",
"stage-1"
],
"plugins": [
"./build/use-lodash-es"
]
}
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
node_modules
bower_components
coverage

dist
es
lib
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __tests__
coverage
docs
example
src
.editorconfig
.eslintignore
.eslintrc.json
Expand Down
10 changes: 10 additions & 0 deletions build/use-lodash-es.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = function() {
return {
visitor: {
ImportDeclaration(path) {
var source = path.node.source
source.value = source.value.replace(/^lodash($|\/)/, 'lodash-es$1')
},
},
}
}
Loading

0 comments on commit c4ef757

Please sign in to comment.