File tree Expand file tree Collapse file tree 6 files changed +34
-10
lines changed
playground/rolldown-dev-react/src Expand file tree Collapse file tree 6 files changed +34
-10
lines changed Original file line number Diff line number Diff line change @@ -563,7 +563,7 @@ export function cssPostPlugin(config: ResolvedConfig): RolldownPlugin {
563
563
! inlined &&
564
564
dataToEsm ( modules , { namedExports : true , preferConst : true } )
565
565
566
- if ( config . command === 'serve' ) {
566
+ if ( config . command === 'serve' && ! config . experimental . rolldownDev ) {
567
567
const getContentWithSourcemap = async ( content : string ) => {
568
568
if ( config . css ?. devSourcemap ) {
569
569
const sourcemap = this . getCombinedSourcemap ( )
Original file line number Diff line number Diff line change @@ -45,19 +45,20 @@ export async function resolvePlugins(
45
45
normalPlugins : Plugin [ ] ,
46
46
postPlugins : Plugin [ ] ,
47
47
) : Promise < Plugin [ ] > {
48
+ const rolldownDev = config . experimental . rolldownDev
48
49
const isBuild = config . command === 'build'
49
50
const isWorker = config . isWorker
50
- const buildPlugins = isBuild
51
- ? await ( await import ( '../build' ) ) . resolveBuildPlugins ( config )
52
- : { pre : [ ] , post : [ ] }
51
+ const buildPlugins =
52
+ isBuild || rolldownDev
53
+ ? await ( await import ( '../build' ) ) . resolveBuildPlugins ( config )
54
+ : { pre : [ ] , post : [ ] }
53
55
const { modulePreload } = config . build
54
56
const depOptimizationEnabled =
55
57
! isBuild &&
56
58
Object . values ( config . environments ) . some (
57
59
( environment ) => ! isDepOptimizationDisabled ( environment . optimizeDeps ) ,
58
60
)
59
61
const enableNativePlugin = config . experimental . enableNativePlugin
60
- const rolldownDev = config . experimental . rolldownDev
61
62
62
63
return [
63
64
depOptimizationEnabled ? optimizedDepsPlugin ( ) : null ,
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export function rolldownDevHandleConfig(
68
68
// this is not "build" option any more (or is there a way to handle entry lazily?)
69
69
build : {
70
70
modulePreload : false ,
71
+ cssCodeSplit : false ,
71
72
rollupOptions : {
72
73
input :
73
74
config . build ?. rollupOptions ?. input ??
@@ -182,10 +183,16 @@ class RolldownEnvironment extends DevEnvironment {
182
183
plugins = plugins . filter (
183
184
( p ) =>
184
185
! ( typeof p . name === 'number' || p . name ?. startsWith ( 'vite:' ) ) ||
185
- [ 'vite:define' , 'vite:build-html' , 'vite:build-metadata' ] . includes (
186
- p . name ,
187
- ) ||
188
- [ 'AliasPlugin' , 'TransformPlugin' ] . includes ( p . constructor . name ) ,
186
+ [
187
+ 'vite:define' ,
188
+ 'vite:build-html' ,
189
+ 'vite:build-metadata' ,
190
+ 'vite:css' ,
191
+ 'vite:css-post' ,
192
+ ] . includes ( p . name ) ||
193
+ [ 'AliasPlugin' , 'TransformPlugin' , 'LoadFallbackPlugin' ] . includes (
194
+ p . constructor . name ,
195
+ ) ,
189
196
)
190
197
plugins = plugins . map ( ( p ) => injectEnvironmentToHooks ( this as any , p ) )
191
198
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import virtualTest from 'virtual:test'
4
4
// @ts -expect-error no type
5
5
import testAlias from 'test-alias'
6
6
import { throwError } from './error'
7
+ // TODO: hmr
8
+ import './test-style.css'
9
+ import testStyleInline from './test-style-inline.css?inline'
7
10
8
11
export function App ( ) {
9
12
const [ count , setCount ] = React . useState ( 0 )
@@ -17,8 +20,15 @@ export function App() {
17
20
</ button >
18
21
< pre > [virtual] { virtualTest } </ pre >
19
22
< pre > [alias] { testAlias } </ pre >
20
- { /* TODO: slightly broken probably due to patching rolldown:runtime during renderChunk */ }
23
+ { /* TODO: source map is slightly broken probably due to patching rolldown:runtime during renderChunk */ }
21
24
< button onClick = { ( ) => throwError ( ) } > stacktrace</ button >
25
+ < pre >
26
+ [css] < span className = "test-style" > orange</ span >
27
+ </ pre >
28
+ < style > { testStyleInline } </ style >
29
+ < pre >
30
+ [css?inline] < span className = "test-style-inline" > orange</ span >
31
+ </ pre >
22
32
</ div >
23
33
</ div >
24
34
)
Original file line number Diff line number Diff line change
1
+ .test-style-inline {
2
+ color : orange;
3
+ }
Original file line number Diff line number Diff line change
1
+ .test-style {
2
+ color : orange;
3
+ }
You can’t perform that action at this time.
0 commit comments