diff --git a/packages/vite/src/node/plugins/index.ts b/packages/vite/src/node/plugins/index.ts index 0598e8fe6bf187..41a96b9618b994 100644 --- a/packages/vite/src/node/plugins/index.ts +++ b/packages/vite/src/node/plugins/index.ts @@ -45,11 +45,13 @@ export async function resolvePlugins( normalPlugins: Plugin[], postPlugins: Plugin[], ): Promise { + const rolldownDev = config.experimental.rolldownDev const isBuild = config.command === 'build' const isWorker = config.isWorker - const buildPlugins = isBuild - ? await (await import('../build')).resolveBuildPlugins(config) - : { pre: [], post: [] } + const buildPlugins = + isBuild || rolldownDev + ? await (await import('../build')).resolveBuildPlugins(config) + : { pre: [], post: [] } const { modulePreload } = config.build const depOptimizationEnabled = !isBuild && @@ -57,7 +59,6 @@ export async function resolvePlugins( (environment) => !isDepOptimizationDisabled(environment.optimizeDeps), ) const enableNativePlugin = config.experimental.enableNativePlugin - const rolldownDev = config.experimental.rolldownDev return [ depOptimizationEnabled ? optimizedDepsPlugin() : null, diff --git a/packages/vite/src/node/server/environments/rolldown.ts b/packages/vite/src/node/server/environments/rolldown.ts index dac2b2577049c1..fb68ff7ce7535a 100644 --- a/packages/vite/src/node/server/environments/rolldown.ts +++ b/packages/vite/src/node/server/environments/rolldown.ts @@ -182,10 +182,16 @@ class RolldownEnvironment extends DevEnvironment { plugins = plugins.filter( (p) => !(typeof p.name === 'number' || p.name?.startsWith('vite:')) || - ['vite:define', 'vite:build-html', 'vite:build-metadata'].includes( - p.name, - ) || - ['AliasPlugin', 'TransformPlugin'].includes(p.constructor.name), + [ + 'vite:define', + 'vite:build-html', + 'vite:build-metadata', + 'vite:css', + 'vite:css-post', + ].includes(p.name) || + ['AliasPlugin', 'TransformPlugin', 'LoadFallbackPlugin'].includes( + p.constructor.name, + ), ) plugins = plugins.map((p) => injectEnvironmentToHooks(this as any, p)) diff --git a/playground/rolldown-dev-react/src/app.tsx b/playground/rolldown-dev-react/src/app.tsx index ab811b64d1b406..b30d3b60a59a67 100644 --- a/playground/rolldown-dev-react/src/app.tsx +++ b/playground/rolldown-dev-react/src/app.tsx @@ -4,6 +4,8 @@ import virtualTest from 'virtual:test' // @ts-expect-error no type import testAlias from 'test-alias' import { throwError } from './error' +import './test-style.css' +import testStyleInline from './test-style-inline.css?inline' export function App() { const [count, setCount] = React.useState(0) @@ -17,8 +19,16 @@ export function App() {
[virtual] {virtualTest}
[alias] {testAlias}
- {/* TODO: slightly broken probably due to patching rolldown:runtime during renderChunk */} + {/* TODO: source map is slightly broken probably due to patching rolldown:runtime during renderChunk */} + +
+          [css?inline] orange
+        
+ {/* TODO */} +
+          [css] orange
+        
) diff --git a/playground/rolldown-dev-react/src/test-style-inline.css b/playground/rolldown-dev-react/src/test-style-inline.css new file mode 100644 index 00000000000000..1e4583bd2a4582 --- /dev/null +++ b/playground/rolldown-dev-react/src/test-style-inline.css @@ -0,0 +1,3 @@ +.test-style-inline { + color: orange; +} diff --git a/playground/rolldown-dev-react/src/test-style.css b/playground/rolldown-dev-react/src/test-style.css new file mode 100644 index 00000000000000..72c963d41acaad --- /dev/null +++ b/playground/rolldown-dev-react/src/test-style.css @@ -0,0 +1,3 @@ +.test-style { + color: orange; +}