developit / microbundle

📦 Zero-configuration bundler for tiny modules.
https://npm.im/microbundle
MIT License
8.05k stars 362 forks source link

How to bundle public folder to dist #1080

Closed yenle16 closed 4 months ago

yenle16 commented 4 months ago

I am developing a preact widget project, in my publice/assets folder there are svg files to use in the project, when I run build, how can this public folder be in the dist folder? "build:widget": "cross-env PREACT_APP_API_URL=$PREACT_APP_API_URL microbundle build --no-sourcemap --external none --define process.env.PREACT_APP_API_URL=$PREACT_APP_API_URL"

rschristian commented 4 months ago

Microbundle does not support this, you'll need to add in a copy step yourself:

"build:widget": "cross-env PREACT_APP_API_URL=$PREACT_APP_API_URL microbundle build --no-sourcemap --external none --define process.env.PREACT_APP_API_URL=$PREACT_APP_API_URL && cp public/assets dist/"

yenle16 commented 4 months ago

So that's it. Thank you