Skip to content

Commit

Permalink
feat: integrate rolldown hmr-poc
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Nov 9, 2024
1 parent 6dbd4b0 commit 3cdfc03
Show file tree
Hide file tree
Showing 11 changed files with 626 additions and 67 deletions.
3 changes: 2 additions & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"dependencies": {
"esbuild": "^0.24.0",
"postcss": "^8.4.47",
"rolldown": "https://pkg.pr.new/rolldown@1fa5d4b",
"react-refresh": "^0.14.2",
"rolldown": "0.13.2-snapshot-a292401-20241105072341",
"rollup": "^4.22.5"
},
"optionalDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import { resolveSSROptions } from './ssr'
import { PartialEnvironment } from './baseEnvironment'
import { createIdResolver } from './idResolver'
import { type OxcOptions, convertEsbuildConfigToOxcConfig } from './plugins/oxc'
import { rolldownDevPluginConfig } from './server/environments/rolldown'

const debug = createDebugger('vite:config')
const promisifiedRealpath = promisify(fs.realpath)
Expand Down Expand Up @@ -508,6 +509,9 @@ export interface ExperimentalOptions {
* @default true
*/
enableNativePlugin?: boolean

rolldownDev?: boolean
rolldownDevReactRefresh?: boolean
}

export interface LegacyOptions {
Expand Down Expand Up @@ -1009,6 +1013,9 @@ export async function resolveConfig(
// run config hooks
const userPlugins = [...prePlugins, ...normalPlugins, ...postPlugins]
config = await runConfigHook(config, userPlugins, configEnv)
if (config.experimental?.rolldownDev) {
config = mergeConfig(config, rolldownDevPluginConfig(config))
}

// Ensure default client and ssr environments
// If there are present, ensure order { client, ssr, ...custom }
Expand Down
5 changes: 5 additions & 0 deletions packages/vite/src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ export async function resolvePlugins(
})
: importGlobPlugin(config),

// TODO: cyclic import?
!isBuild &&
config.experimental.rolldownDev &&
(await import('../server/environments/rolldown')).rolldownDevPlugin(),

...postPlugins,

...buildPlugins.post,
Expand Down
Loading

0 comments on commit 3cdfc03

Please sign in to comment.