File tree 5 files changed +16
-19
lines changed
5 files changed +16
-19
lines changed Original file line number Diff line number Diff line change @@ -641,7 +641,19 @@ async function buildEnvironment(
641
641
// TODO: remove this and enable rolldown's CSS support later
642
642
moduleTypes : {
643
643
...options . rollupOptions . moduleTypes ,
644
- '.css' : 'js' ,
644
+ // https://github.com/rolldown/rolldown/blob/4020de442a8ab0f7973794ead3b8aa04e316d558/crates/rolldown/src/module_loader/module_task.rs#L120
645
+ // @ts -expect-error css
646
+ '.sass' : 'css' ,
647
+ // @ts -expect-error css
648
+ '.scss' : 'css' ,
649
+ // @ts -expect-error css
650
+ '.sss' : 'css' ,
651
+ // @ts -expect-error css
652
+ '.styl' : 'css' ,
653
+ // @ts -expect-error css
654
+ '.stylus' : 'css' ,
655
+ // @ts -expect-error css
656
+ '.less' : 'css' ,
645
657
} ,
646
658
}
647
659
Original file line number Diff line number Diff line change @@ -799,11 +799,6 @@ async function prepareRolldownOptimizerRun(
799
799
extensions : [ '.js' , '.css' ] ,
800
800
conditionNames : [ 'browser' ] ,
801
801
} ,
802
- // TODO: remove this and enable rolldown's CSS support later
803
- moduleTypes : {
804
- '.css' : 'js' ,
805
- ...rollupOptions . moduleTypes ,
806
- } ,
807
802
} )
808
803
if ( canceled ) {
809
804
await bundle . close ( )
@@ -1083,11 +1078,6 @@ export async function extractExportsData(
1083
1078
...remainingRollupOptions ,
1084
1079
plugins,
1085
1080
input : [ filePath ] ,
1086
- // TODO: remove this and enable rolldown's CSS support later
1087
- moduleTypes : {
1088
- '.css' : 'js' ,
1089
- ...remainingRollupOptions . moduleTypes ,
1090
- } ,
1091
1081
} )
1092
1082
const result = await build . generate ( {
1093
1083
...rollupOptions . output ,
Original file line number Diff line number Diff line change @@ -622,8 +622,7 @@ export function cssPostPlugin(config: ResolvedConfig): RolldownPlugin {
622
622
code = `export default ${ JSON . stringify ( content ) } `
623
623
} else {
624
624
// empty module when it's not a CSS module nor `?inline`
625
- // NOTE: add `export {}` otherwise rolldown treats the module as CJS (https://github.com/rolldown/rolldown/issues/2394)
626
- code = 'export {}'
625
+ code = css
627
626
}
628
627
629
628
return {
Original file line number Diff line number Diff line change @@ -232,7 +232,8 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): [Plugin] {
232
232
}
233
233
} ,
234
234
235
- async transform ( source , importer ) {
235
+ async transform ( source , importer , opts ) {
236
+ if ( opts ?. moduleType === 'css' ) return
236
237
if ( isInNodeModules ( importer ) && ! dynamicImportPrefixRE . test ( source ) ) {
237
238
return
238
239
}
Original file line number Diff line number Diff line change @@ -85,11 +85,6 @@ async function bundleWorkerEntry(
85
85
onwarn ( warning , warn ) {
86
86
onRollupWarning ( warning , warn , workerEnvironment )
87
87
} ,
88
- // TODO: remove this and enable rolldown's CSS support later
89
- moduleTypes : {
90
- '.css' : 'js' ,
91
- ...rollupOptions . moduleTypes ,
92
- } ,
93
88
// preserveEntrySignatures: false,
94
89
} )
95
90
let chunk : OutputChunk
You can’t perform that action at this time.
0 commit comments