Webpack / Babel Flashcards
What is Webpack?
A package that bundles js files together from across your project.
How do you add a devDependency to a package?
Use npm install <package-name> —save-dev</package-name>
What is an NPM script?
Terminal commands that automate repetitive tasks
How do you execute Webpack with npm run?
Assuming you’ve got the npm script for building Webpack —> npm run build
Can be built in either product or development mode
After making changes to code in src folder you need to…
Rerun build command and have Webpack rebuild main.js with the new code (unless you’re watching those files for changes)
What is Babel?
A tool chain that converts code into other code. Useful for ES6 —> ES5, JSX / React, and TypeScript stripping
What is a Plug-in?
A software component that adds a feature to an existing program. (Think themes / skins)
Also a function that babel is built on.
What is a Webpack loader?
Tranformations applied to the source code of a module that allow you to pre-process files. They’re a good way to handle front-end build steps.
How can you make Babel and Webpack work together?
Add webpack.config.js file with a rule for transforming .js files. Add the plugins you’d like for executing those transforms, and then build the project normally with webpack.