Webpack Flashcards
What is Webpack?
Webpack is an open-source JavaScript module bundler. It is made primarily for JavaScript, but it can transform front-end assets such as HTML, CSS, and images if the corresponding loaders are included. Webpack takes modules with dependencies and generates static assets representing those modules.
How do you add a devDependency to a package?
npm install –save-dev
What is an NPM script?
An npm script is a convenient way to bundle common shell commands for your project. They are typically commands, or a string of commands, which would normally be entered at the command line in order to do something with your application. Scripts are stored in a project’s package.
How do you execute Webpack with npm run?
Add an NPM script to package.json named “build” that executes webpack like this:
“scripts”: {
“build”: “webpack”,
“test”: “echo "Error: no test specified" && exit 1”
}
Try your NPM script from the command line and look for a main.js file in dist/.
npm run build