@@ -3,7 +3,7 @@ import assert from 'node:assert/strict'
33import { createRequire } from 'node:module'
44import { fileURLToPath } from 'node:url'
55import path from 'node:path'
6- import replace from '@rollup/plugin-replace '
6+ import { replacePlugin } from 'rolldown/experimental '
77import pico from 'picocolors'
88import polyfillNode from '@rolldown/plugin-node-polyfills'
99import { entries } from './scripts/aliases.js'
@@ -117,7 +117,7 @@ function createConfig(format, output, plugins = []) {
117117
118118 const isProductionBuild =
119119 process . env . __DEV__ === 'false' ||
120- / \. p r o d \. j s $ / . test ( output . entryFileNames || '' )
120+ / \. p r o d \. j s $ / . test ( String ( output . entryFileNames ) || '' )
121121 const isBundlerESMBuild = / e s m - b u n d l e r / . test ( format )
122122 const isBrowserESMBuild = / e s m - b r o w s e r / . test ( format )
123123 const isServerRenderer = name === 'server-renderer'
@@ -219,9 +219,6 @@ function createConfig(format, output, plugins = []) {
219219
220220 // esbuild define is a bit strict and only allows literal json or identifiers
221221 // so we still need replace plugin in some cases
222- /**
223- * @returns {import('rolldown').Plugin[] }
224- */
225222 function resolveReplace ( ) {
226223 /** @type {Record<string, string> } */
227224 const replacements = { }
@@ -252,8 +249,7 @@ function createConfig(format, output, plugins = []) {
252249 }
253250
254251 if ( Object . keys ( replacements ) . length ) {
255- // @ts -expect-error Rollup plugin type still incompatible
256- return [ replace ( { values : replacements , preventAssignment : true } ) ]
252+ return [ replacePlugin ( replacements ) ]
257253 } else {
258254 return [ ]
259255 }
@@ -359,7 +355,7 @@ function createMinifiedConfig(/** @type {PackageFormat} */ format) {
359355 return createConfig (
360356 format ,
361357 {
362- entryFileNames : outputConfigs [ format ] . entryFileNames ? .replace (
358+ entryFileNames : String ( outputConfigs [ format ] . entryFileNames ) . replace (
363359 / \. j s $ / ,
364360 '.prod.js' ,
365361 ) ,
0 commit comments