11import type { ConfigEnv , Plugin , ResolvedConfig , ViteDevServer } from 'vite' ;
22import process from 'node:process' ;
3- import { createFilter } from '@rollup/pluginutils' ;
43import { dim } from 'colorette' ;
54import consola from 'consola' ;
65import dotenv from 'dotenv' ;
76import { expand } from 'dotenv-expand' ;
8- import { render } from 'ejs' ;
7+ import ejs from 'ejs' ;
98import fg from 'fast-glob' ;
109import fse from 'fs-extra' ;
1110import { minify } from 'html-minifier-terser' ;
11+ import { minimatch } from 'minimatch' ;
1212import { parse } from 'node-html-parser' ;
1313import path , { dirname , join } from 'pathe' ;
1414import { normalizePath } from 'vite' ;
@@ -119,7 +119,7 @@ function createPlugin(userOptions: UserOptions = {}): Plugin {
119119 if ( input ) {
120120 return {
121121 build : {
122- rollupOptions : {
122+ rolldownOptions : {
123123 input,
124124 } ,
125125 } ,
@@ -271,7 +271,7 @@ async function renderHtml(html: string, config: any): Promise<string> {
271271 ...( env || { } ) ,
272272 ...data ,
273273 } ;
274- let result = await render ( html , ejsData , ejsOptions ) ;
274+ let result = await ejs . render ( html , ejsData , ejsOptions ) ;
275275 if ( entry ) {
276276 result = removeEntryScript ( result , verbose ) ;
277277 result = result . replace ( bodyInjectRE , `<script type="module" src="${ normalizePath ( `${ entry } ` ) } "></script></body>` ) ;
@@ -292,7 +292,7 @@ function getPage(userOptions: UserOptions, name: string, viteConfig: ResolvedCon
292292}
293293
294294function isMpa ( viteConfig : ResolvedConfig | undefined ) : boolean {
295- const input = viteConfig ?. build ?. rollupOptions ?. input ?? undefined ;
295+ const input = viteConfig ?. build ?. rolldownOptions ?. input ?? undefined ;
296296 return typeof input !== 'string' && Object . keys ( input || { } ) . length > 1 ;
297297}
298298
@@ -352,7 +352,7 @@ function createRewire(reg: string, page: Page, baseUrl: string, proxyUrlKeys: st
352352 } ;
353353}
354354
355- const htmlFilter = createFilter ( [ '**/*.html' ] ) ;
355+ const htmlFilter = ( id : string ) => minimatch ( id , '**/*.html' ) ;
356356
357357function getOptions ( _minify : boolean ) {
358358 return {
0 commit comments