-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from Esri/rollup-tree-shaking
Rollup treeshaking and tslib
- Loading branch information
Showing
20 changed files
with
2,398 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": [["@babel/env", { "modules": false }]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
16 changes: 0 additions & 16 deletions
16
demos/tree-shaking/package-lock.json → demos/tree-shaking-webpack/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
demos/tree-shaking/package.json → demos/tree-shaking-webpack/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.