File tree Expand file tree Collapse file tree 2 files changed +13
-17
lines changed
packages/rollup-plugin/src Expand file tree Collapse file tree 2 files changed +13
-17
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @vanilla-extract/rollup-plugin ' : patch
3
+ ---
4
+
5
+ allow plugin to work in rolldown
Original file line number Diff line number Diff line change @@ -116,30 +116,21 @@ export function vanillaExtractPlugin({
116
116
} ,
117
117
} ;
118
118
} ,
119
-
120
- // Emit .css assets
121
- moduleParsed ( moduleInfo ) {
122
- moduleInfo . importedIdResolutions . forEach ( ( resolution ) => {
123
- if ( resolution . meta . css && ! extract ) {
124
- resolution . meta . assetId = this . emitFile ( {
125
- type : 'asset' ,
126
- name : resolution . id ,
127
- source : resolution . meta . css ,
128
- } ) ;
129
- }
130
- } ) ;
131
- } ,
132
-
133
- // Replace .css import paths with relative paths to emitted css files
119
+ // Emit .css assets and replace .css import paths with relative paths to emitted css files
134
120
renderChunk ( code , chunkInfo ) {
135
121
const chunkPath = dirname ( chunkInfo . fileName ) ;
136
122
const output = chunkInfo . imports . reduce ( ( codeResult , importPath ) => {
137
123
const moduleInfo = this . getModuleInfo ( importPath ) ;
138
- if ( ! moduleInfo ?. meta . assetId ) {
124
+ if ( ! moduleInfo ?. meta . css || extract ) {
139
125
return codeResult ;
140
126
}
141
127
142
- const assetPath = this . getFileName ( moduleInfo ?. meta . assetId ) ;
128
+ const assetId = this . emitFile ( {
129
+ type : 'asset' ,
130
+ name : moduleInfo . id ,
131
+ source : moduleInfo . meta . css ,
132
+ } ) ;
133
+ const assetPath = this . getFileName ( assetId ) ;
143
134
const relativeAssetPath = `./${ normalize (
144
135
relative ( chunkPath , assetPath ) ,
145
136
) } `;
You can’t perform that action at this time.
0 commit comments