feat: add vanilla-extract support with Parcel 2.10.0 upgrade #1337
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for vanilla-extract CSS-in-TypeScript library to Plasmo, enabling developers to write type-safe, zero-runtime CSS.
Changes
1. Custom Parcel Transformer (
@plasmohq/parcel-transformer-vanilla-extract)Created a new transformer package that:
@vanilla-extract/integrationfor CSS compilation.css.tsfiles at build timeImplementation:
core/parcel-transformer-vanilla-extract/2. Parcel Upgrade (2.9.3 → 2.10.0)
Upgraded Parcel to version 2.10.0 to enable
node:protocol support, which is required for vanilla-extract dependencies.Why this was necessary:
@vanilla-extract/integrationusesmllymllyimports Node.js builtins with thenode:protocol (e.g.,require('node:module'))node:prefix in module resolutionSee
PARCEL_UPGRADE.mdfor detailed documentation of the upgrade rationale.Changed packages:
@parcel/*packages upgraded from 2.9.3 to 2.10.03. Example:
with-vanilla-extractAdded a complete example demonstrating:
.parcelrcconfigurationExample structure:
4. Core Configuration Update
Modified
core/parcel-config/index.jsonto include the vanilla-extract transformer in the default Plasmo configuration:{ "transformers": { "*.css.ts": ["@plasmohq/parcel-transformer-vanilla-extract"] } }5. Example
with-vanilla-extract example PR: PlasmoHQ/examples#86
Breaking Changes
None. The Parcel upgrade is backward compatible and all existing examples continue to work.
Related
node:prefix for CJS dependencies parcel-bundler/parcel#9244node:should always be a builtin parcel-bundler/parcel#9250