Because the vite use esbuild define option at optimizer, the rollup has [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace#rollupplugin-replace) to do it, it using string match to replace, it is performance friendly but other ecosystem using last to do it, eg swc/webpack.
I think we can use @rollup/plugin-replace to do it at milestone 1. It means we need to support some plugin API for the plugin, it is easy to implement.
But we need re-think it how to support it at rolldown for better performance and correct replace result.
Because the vite use esbuild
defineoption at optimizer, the rollup has[@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace#rollupplugin-replace)to do it, it using string match to replace, it is performance friendly but other ecosystem using last to do it, egswc/webpack.I think we can use
@rollup/plugin-replaceto do it at milestone 1. It means we need to support some plugin API for the plugin, it is easy to implement.But we need re-think it how to support it at rolldown for better performance and correct replace result.