Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .parcelrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"*.svg": ["@parcel/transformer-svg-react"],
"packages/@react-aria/example-theme/**/*.css": ["@parcel/transformer-css"],
"starters/docs/src/*.css": ["@parcel/transformer-css"],
"*.css": ["...", "parcel-transformer-css-env"],
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed anymore for old v3 docs, the default CSS transformer in parcel now handles this. I repurposed this plugin as above to handle the issue with the build.

"*.{js,mjs,jsm,jsx,es6,cjs,ts,tsx}": [
"@parcel/transformer-js",
"@parcel/transformer-react-refresh-wrap"
Expand Down
13 changes: 9 additions & 4 deletions packages/dev/parcel-transformer-css-env/CSSEnvTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ const {Transformer} = require('@parcel/plugin');
module.exports = new Transformer({
async transform({asset, options}) {
// Normalize CSS so it always has the same environment and isn't duplicated.
// This is necessary because the server bundle has a "node" environment, whereas
// the client bundle has a "browser" environment. We want them to end up resolving
// to the same asset.
// This is so the legacy JS bundle and the modern JS bundle share the same CSS.
asset.setEnvironment({
context: 'browser',
engines: {
browsers: 'baseline widely available'
},
shouldOptimize: asset.env.shouldOptimize
shouldOptimize: asset.env.shouldOptimize,
outputFormat: asset.env.outputFormat,
isLibrary: asset.env.isLibrary,
shouldScopeHoist: asset.env.shouldScopeHoist,
includeNodeModules: asset.env.includeNodeModules,
loc: asset.env.loc,
sourceMap: asset.env.sourceMap,
sourceType: asset.env.sourceType
});

return [asset];
Expand Down
Loading