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 @@ -651,7 +651,19 @@ async function buildEnvironment(
651
651
// TODO: remove this and enable rolldown's CSS support later
652
652
moduleTypes : {
653
653
...options . rollupOptions . moduleTypes ,
654
- '.css' : 'js' ,
654
+ // https://github.com/rolldown/rolldown/blob/4020de442a8ab0f7973794ead3b8aa04e316d558/crates/rolldown/src/module_loader/module_task.rs#L120
655
+ // @ts -expect-error css
656
+ '.sass' : 'css' ,
657
+ // @ts -expect-error css
658
+ '.scss' : 'css' ,
659
+ // @ts -expect-error css
660
+ '.sss' : 'css' ,
661
+ // @ts -expect-error css
662
+ '.styl' : 'css' ,
663
+ // @ts -expect-error css
664
+ '.stylus' : 'css' ,
665
+ // @ts -expect-error css
666
+ '.less' : 'css' ,
655
667
} ,
656
668
}
657
669
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 @@ -235,7 +235,8 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): [Plugin] {
235
235
}
236
236
} ,
237
237
238
- async transform ( source , importer ) {
238
+ async transform ( source , importer , opts ) {
239
+ if ( opts ?. moduleType === 'css' ) return
239
240
if ( isInNodeModules ( importer ) && ! dynamicImportPrefixRE . test ( source ) ) {
240
241
return
241
242
}
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