Search code examples
parceljs

How to build assets separately from the rest of the app with Parcel


I have a project that I am building with parcel. Since it is mostly static, I only have some files that should be updated once a day, I put the project on aws s3 bucket. I am thinking of updating the files that should be updated once a day, with a lambda function. But, in my project that is structured like this:

src/
   assets/
   components/
   main.js
   ...

In the folder assets, I have two other folders data and icons. Data folder holds json files that should be updated once a day.

assets/data/
      /icons/

When I run parcel to build a project, I see that all files inside icons folder are built as individual files.

enter image description here

How can I make files inside the data folder to build separately so that I know which files I need to target in order to update them?


Solution

  • I found this package parcel-plugin-static-files-copy that does exactly what I need. Only had to add this to my package.json:

    "staticFiles": {
      "staticPath": "src/assets/data"
    }