@@ -316,6 +316,104 @@ All of these changes are to be made in the "scripts" block near the top of the f
316
316
| babel-preset-es2015-node | Version Detection |
317
317
| babel-preset-latest-minimal | Feature Detection |
318
318
319
+ #### Build Script Style
320
+
321
+ | ES5 | Transpiled |
322
+ | -------------------------------- | ------------------------------------- |
323
+ | No waiting for transpile; faster | Enjoy the latest features |
324
+ | No transpiler dependency | Consistent coding style |
325
+ | | Use the same linting rules everywhere |
326
+ | | Can eventually remove transpiler |
327
+
328
+ Change "prestart" script to use babel-node
329
+
330
+ ` babel-node buildScripts/startMessage.js `
331
+
332
+
333
+
334
+ ## Module #7 : Bundling
335
+
336
+ #### Why use bundling?
337
+
338
+ - CommonJS does not work in web browsers; just NodeJS
339
+ - Package project into file(s)
340
+ - Improve Node performance
341
+
342
+ #### Module Formats
343
+
344
+ - Old Module Formats
345
+
346
+ - ##### IIFE (Immediately Invoked Function Expressions)
347
+
348
+ - ##### AMD (Asynchronous Module Definition)
349
+
350
+ - ##### CJS (CommonJS)
351
+
352
+ - ##### UMD (Universal Module Definition)
353
+
354
+ - ##### ES6 Modules (author's choice)
355
+
356
+ - Standardized
357
+ - Statically analyzable
358
+ - Improved autocomplete
359
+ - Intelligent refactoring
360
+ - Fails fast
361
+ - Tree shaking (dead code discovery?)
362
+ - Easy to read
363
+ - Named Imports
364
+ - Default exports
365
+
366
+ #### Selecting a Bundler
367
+
368
+ - OLD Bundler
369
+
370
+ - ##### Require.JS
371
+
372
+ - First popular bundler
373
+ - Utilizes and helped popularize AMD pattern
374
+
375
+ - ##### Browserify
376
+
377
+ - Simple
378
+ - The first bundler to reach mass adoption
379
+ - Bundle npm packages for the web
380
+ - Large plugin ecosystem
381
+ - Linting, Transpiling, etc.
382
+
383
+ - ##### Webpack (author's choice)
384
+
385
+ - Comprehensive
386
+ - Bundles more than just JavaScript
387
+ - Import CSS, Images, just like JavaScript
388
+ - Built in hot-reloading web server
389
+
390
+ - ##### Rollup
391
+
392
+ - Tree shaking
393
+ - Faster loading production code
394
+ - Quite new?
395
+ - Great choice for library authors
396
+ - No hot reloading and code splitting yet
397
+
398
+ - ##### JSPM
399
+
400
+ - Runtime loader
401
+ - Uses SystemJS; universal module loader
402
+ - Can load modules at runtime
403
+ - Has its own package manager
404
+ - Can install from npm, git
405
+ - Uses Rollup
406
+
407
+ #### Webpack
408
+
409
+ - More than just JavaScript
410
+ - CSS, Images, Fonts, HTML
411
+ - Bundle splitting
412
+ - Hot module reloading
413
+ - Webpack 2 soon --> tree shaking coming
414
+
415
+
416
+
319
417
## Bibliography
320
418
321
419
The Checklist Manifesto by Atul Gawande
0 commit comments