Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup treeshaking and tslib #498

Merged
merged 6 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions demos/tree-shaking-rollup/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [["@babel/env", { "modules": false }]]
}
9 changes: 9 additions & 0 deletions demos/tree-shaking-rollup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Running this demo

This demo shows how to have rollup [tree shake](https://rollupjs.org/guide/en#tree-shaking) `@esri/rest-js` and only include methods that are actually being called in its output bundle.

1. Make sure you run `npm run bootstrap` in the root folder to setup the dependencies
1. cd into `/demos/tree-shaking-rollup/`
1. Run `npm run build`


File renamed without changes.
2,225 changes: 2,225 additions & 0 deletions demos/tree-shaking-rollup/package-lock.json

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions demos/tree-shaking-rollup/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@esri/arcgis-rest-tree-shaking-rollup",
"version": "1.19.0",
"private": true,
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup -c"
},
"keywords": [],
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"babel-loader": "^8.0.5",
"rollup": "^1.7.4",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-babel": "^4.3.2"
},
"dependencies": {
"@esri/arcgis-rest-items": "^1.19.0",
"@esri/arcgis-rest-request": "^1.19.0"
}
}
17 changes: 17 additions & 0 deletions demos/tree-shaking-rollup/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// rollup.config.js
import resolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";

export default {
input: "src/index.js",
output: {
file: "dist/bundle.js",
format: "iife"
},
plugins: [
resolve(),
babel({
exclude: "node_modules/**" // only transpile our source code
})
]
};
8 changes: 8 additions & 0 deletions demos/tree-shaking-rollup/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { searchItems } from "@esri/arcgis-rest-items";

let element = document.createElement("div");
document.body.appendChild(element);

searchItems("water").then(response => {
element.innerHTML = JSON.stringify(response); // false
});
9 changes: 9 additions & 0 deletions demos/tree-shaking-webpack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Running this demo

This demo shows how to have webpack [tree shake](https://rollupjs.org/guide/en#tree-shaking) `@esri/rest-js` and only include methods that are actually being called in its output bundle.

1. Make sure you run `npm run bootstrap` in the root folder to setup the dependencies
1. cd into `/demos/tree-shaking-webpack/`
1. Run `npm run build`


11 changes: 11 additions & 0 deletions demos/tree-shaking-webpack/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>shaking the tree</title>
</head>
<body>
<script src="dist/bundle.js"></script>
</body>
</html>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@esri/arcgis-rest-webpack-demo",
"name": "@esri/arcgis-rest-tree-shaking-webpack",
"version": "1.19.0",
"private": true,
"description": "",
Expand Down
11 changes: 0 additions & 11 deletions demos/tree-shaking/README.md

This file was deleted.

41 changes: 30 additions & 11 deletions demos/vue/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading