Skip to content

Instantly share code, notes, and snippets.

@chalu
Created February 23, 2019 15:11
Show Gist options
  • Save chalu/12f434892663f1b3ef5a8db97f50cc34 to your computer and use it in GitHub Desktop.
Save chalu/12f434892663f1b3ef5a8db97f50cc34 to your computer and use it in GitHub Desktop.
Tree Shaking With Parcel Bundler
export const add = (x, y) => x + y;
export const minus = (x, y) => x - y;
export const divide = (x, y) => x / y;
export const multiply = (x, y) => x * y;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Test Parcel Bundler</title>
</head>
<body>
<script src="./index.js"></script>
</body>
</html>
import { add } from './calculator';
console.log( add(2, 5) );
{
"name": "parcle-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "parcel src/index.html",
"build": "parcel build src/index.html --experimental-scope-hoisting"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment