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 @@ -644,7 +644,19 @@ async function buildEnvironment(
644
644
// TODO: remove this and enable rolldown's CSS support later
645
645
moduleTypes : {
646
646
...options . rollupOptions . moduleTypes ,
647
- '.css' : 'js' ,
647
+ // https://github.com/rolldown/rolldown/blob/4020de442a8ab0f7973794ead3b8aa04e316d558/crates/rolldown/src/module_loader/module_task.rs#L120
648
+ // @ts -expect-error css
649
+ '.sass' : 'css' ,
650
+ // @ts -expect-error css
651
+ '.scss' : 'css' ,
652
+ // @ts -expect-error css
653
+ '.sss' : 'css' ,
654
+ // @ts -expect-error css
655
+ '.styl' : 'css' ,
656
+ // @ts -expect-error css
657
+ '.stylus' : 'css' ,
658
+ // @ts -expect-error css
659
+ '.less' : 'css' ,
648
660
} ,
649
661
}
650
662
Original file line number Diff line number Diff line change @@ -794,11 +794,6 @@ async function prepareRolldownOptimizerRun(
794
794
extensions : [ '.js' , '.css' ] ,
795
795
conditionNames : [ 'browser' ] ,
796
796
} ,
797
- // TODO: remove this and enable rolldown's CSS support later
798
- moduleTypes : {
799
- '.css' : 'js' ,
800
- ...rollupOptions . moduleTypes ,
801
- } ,
802
797
} )
803
798
if ( canceled ) {
804
799
await bundle . close ( )
@@ -1078,11 +1073,6 @@ export async function extractExportsData(
1078
1073
...remainingRollupOptions ,
1079
1074
plugins,
1080
1075
input : [ filePath ] ,
1081
- // TODO: remove this and enable rolldown's CSS support later
1082
- moduleTypes : {
1083
- '.css' : 'js' ,
1084
- ...remainingRollupOptions . moduleTypes ,
1085
- } ,
1086
1076
} )
1087
1077
const result = await build . generate ( {
1088
1078
...rollupOptions . output ,
Original file line number Diff line number Diff line change @@ -611,8 +611,7 @@ export function cssPostPlugin(config: ResolvedConfig): RolldownPlugin {
611
611
code = `export default ${ JSON . stringify ( content ) } `
612
612
} else {
613
613
// empty module when it's not a CSS module nor `?inline`
614
- // NOTE: add `export {}` otherwise rolldown treats the module as CJS (https://github.com/rolldown/rolldown/issues/2394)
615
- code = 'export {}'
614
+ code = css
616
615
}
617
616
618
617
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