File tree 4 files changed +66
-0
lines changed
4 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " tree-shaking" ,
3
+ "version" : " 0.1.0" ,
4
+ "description" : " Code examples for the tree-shaking guide." ,
5
+ "main" : " n/a" ,
6
+ "scripts" : {
7
+ "build" : " webpack" ,
8
+ "test" : " echo \" Error: no test specified\" && exit 1"
9
+ },
10
+ "repository" : {
11
+ "type" : " git" ,
12
+ "url" : " git+https://github.com/TheDutchCoder/webpack-guides-code-examples.git"
13
+ },
14
+ "keywords" : [
15
+ " tree" ,
16
+ " shaking" ,
17
+ " webpack" ,
18
+ " dead" ,
19
+ " code" ,
20
+ " removal"
21
+ ],
22
+ "author" : " Greg Venech" ,
23
+ "license" : " ISC" ,
24
+ "bugs" : {
25
+ "url" : " https://github.com/TheDutchCoder/webpack-guides-code-examples/issues"
26
+ },
27
+ "homepage" : " https://github.com/TheDutchCoder/webpack-guides-code-examples#readme" ,
28
+ "devDependencies" : {
29
+ "uglifyjs-webpack-plugin" : " ^0.4.6" ,
30
+ "webpack" : " ^3.5.5"
31
+ }
32
+ }
Original file line number Diff line number Diff line change
1
+ import { cube } from './math.js' ;
2
+
3
+ function component ( ) {
4
+ var element = document . createElement ( 'div' ) ;
5
+
6
+ element . innerHTML = [
7
+ 'Hello webpack!' ,
8
+ '5 cubed is equal to ' + cube ( 5 )
9
+ ] . join ( '\n\n' ) ;
10
+
11
+ return element ;
12
+ }
13
+
14
+ document . body . appendChild ( component ( ) ) ;
Original file line number Diff line number Diff line change
1
+ export function square ( x ) {
2
+ return x * x ;
3
+ }
4
+
5
+ export function cube ( x ) {
6
+ return x * x * x ;
7
+ }
Original file line number Diff line number Diff line change
1
+ const path = require ( 'path' ) ;
2
+ const UglifyJSPlugin = require ( 'uglifyjs-webpack-plugin' ) ;
3
+
4
+ module . exports = {
5
+ entry : './src/index.js' ,
6
+ output : {
7
+ filename : 'bundle.js' ,
8
+ path : path . resolve ( __dirname , 'dist' )
9
+ } ,
10
+ plugins : [
11
+ new UglifyJSPlugin ( )
12
+ ]
13
+ } ;
You can’t perform that action at this time.
0 commit comments