@@ -10,7 +10,6 @@ export default defineConfig((_env) => ({
1010 react ( ) ,
1111 vitePluginWorkerEnvironment ( ) ,
1212 vitePluginFetchModuleServer ( ) ,
13- rolldownPluginRollupFileUrl ( ) ,
1413 ] ,
1514 environments : {
1615 client : {
@@ -219,41 +218,3 @@ function PromiseWithReoslvers<T>(): PromiseWithResolvers<T> {
219218 } ) ;
220219 return { promise, resolve, reject } ;
221220}
222-
223- // workaround until https://github.com/rolldown/rolldown/pull/3488
224- import path from "node:path" ;
225- function rolldownPluginRollupFileUrl ( ) : Plugin {
226- return {
227- name : rolldownPluginRollupFileUrl . name ,
228- renderChunk : {
229- order : "pre" ,
230- handler ( code , chunk ) {
231- if ( ! code . includes ( "import.meta.ROLLUP_FILE_URL_" ) ) {
232- return ;
233- }
234- const matches = code . matchAll ( / i m p o r t .m e t a .R O L L U P _ F I L E _ U R L _ ( \w + ) / dg) ;
235- const output = new MagicString ( code ) ;
236- for ( const match of matches ) {
237- const referenceId = match [ 1 ] ! ;
238- const assetFileName = this . getFileName ( referenceId ) ;
239- const relativePath =
240- "./" +
241- path . relative (
242- path . resolve ( chunk . fileName , ".." ) ,
243- path . resolve ( assetFileName ) ,
244- ) ;
245- const replacement = `new URL(${ JSON . stringify ( relativePath ) } , import.meta.url)` ;
246- const [ start , end ] = match . indices ! [ 0 ] ! ;
247- output . update ( start , end , replacement ) ;
248- }
249- if ( output . hasChanged ( ) ) {
250- return {
251- code : output . toString ( ) ,
252- map : output . generateMap ( { hires : "boundary" } ) ,
253- } ;
254- }
255- return ;
256- } ,
257- } ,
258- } ;
259- }
0 commit comments