This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

Day 33

aronson(25)
Published in
#code
Words
247
Reading
2 min
Listen
Play
9y

February 15th 2018

Hello! At the ES6 course by Wes Bos I learned about npms and bundling. We used System JS-which another way of bundling. It is part of npm.
you can run it in the browser

        script src="https://jspm.io/[email protected]"/script

Or you load it in”
npm init - to install a package.json file

      npm install browser-sync --save-dev (you might have to clear cache

"scripts": {
"server":"browser-sync start --directory --server --files '*.js, *.html, *.css'"
},
to run server
npm run server – to run server

You don't have to npm install every time.
Babel - JS compiler
npm install babel-cli@next

"scripts": {
"babel": "babel app.js --watch --out-file app-compiled.js"
},
the script that we need
Babel - Plugins

      npm install babel-present-env@next

In order to help run experimental stuff

Polyfil

Babel only works on syntax. But there are also new methods babel does not convert this, we have to use a Polyfil. If the browser does not have it the browser will recreate it

script src="https://cdn.polyfill.io/v2/polyfill.min.js"/script

npm install --save-dev babel-plugin-transform-object-rest-spread

{
"plugins": ["transform-object-rest-spread"]
}

At the Web Development Bootcamp by Colt Steel we learned more about Node.js and how we use it. Node.js node works in terminal, and it is a way to write JS on the server side

REPL - read evaluate print loop
accumulator pattern, to have a variable that will accumulate something as we iterate through it

NPM - package manager for JS

package - code that someone else as written
It is really easy to install.

Cheers!