Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 882 Bytes

79-Building-with-parcel.md

File metadata and controls

12 lines (8 loc) · 882 Bytes

Bundling With Parcel and NPM Scripts

To bundle your JavaScript code with Parcel and NPM Scripts, follow these steps:

  1. Install Parcel as a dev dependency by running npm install parcel-bundler --save-dev.
  2. Create an entry point file for your application (e.g. index.js).
  3. Add a build script to your package.json file that runs Parcel on your entry point file. For example: "build": "parcel build index.js".
  4. Run the build script using NPM by running npm run build.

When you run the build script, Parcel will analyze your code and create a bundled version of it in a dist directory. The bundled file is optimized for production use and can be added to your HTML file like any other JavaScript file.

You can also customize your build process further by using options and plugins provided by Parcel. Check out the official documentation for more information.