NPM Flashcards
What is NPM?
It can refer to 3 things: the npm website, the CLI for using npm, or the registry of packages that npm offers
What is a package?
A directory that contains a package.json and other files
How can you create a package.json with npm?
npm init -y
What is a dependency and how do you add one to a package?
A dependency is an independent directory that your package needs to run, and they can be added using npm install
What happens when you add a dependency to a package with npm?
The dependency gets added to the node_modules directory in the package directory
What is Webpack?
A tool that bundles all JS modules into a single file
How do you execute Webpack with npm run?
In the “scripts” property of package.json add a property "anything": "webpack"
, then run the command line npm run anything
What is an NPM script?
The script for running an npm package
What is Babel?
A JavaScript compiler that converts all ES6+ code into ES5, and in general ensures that any code will be compatible for reading
What is a Plug-in?
A program added to an application that provides extra features
What is a Webpack loader?
A Webpack plug-in that transforms the source code before Webpack bundles the code
How can you make Babel and Webpack work together?
You install babel-loader and assign the module.exports.module.rules[0].use.loader = ‘babel-loader’ in the webpack.config.js file