Create a Production Build
To create a production bundle for distribution, run:
pnpm build
# OR
npm run buildGenerating a zip bundle
To create a production zip bundle ready to be uploaded to the web stores, use the package command:
pnpm package
# OR
npm run packageIf you would like to combine the building and packaging process, use the --zip flag with the build command instead:
pnpm build --zip
# OR
npm run build -- --zipWith a specific target
The build command accepts a --target flag. Use it to specify a browser and manifest version combination to build for:
plasmo build --target=firefox-mv2The final bundle will be available in the build/firefox-mv2-prod directory.
For a list of officially supported targets, visit this link.
With a custom tag
Plasmo uses the prod tag for your production build. You can use the --tag flag to change this behavior:
plasmo build --tag=stagingThe command above will:
- Create the bundle in the
build/chrome-mv3-stagingdirectory - Set the
process.env.PLASMO_TAGenvironment variables tostaging - Parse and prioritize
.env.stagingor.env.staging.localif any exist
With source maps
By default, Plasmo does not generate source maps for your production bundle. However, you can use the --source-maps flag to change this behavior:
plasmo build --source-mapsBundle Buddy
If you'd like to analyze your bundle, you can use the --bundle-buddy flag, combined with --source-maps to generate a Bundle Buddy (opens in a new tab) report:
plasmo build --source-maps --bundle-buddy