Skip to content

Commit 6b01093

Browse files
committed
optimize index.ts
1 parent 33a158f commit 6b01093

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ async function generateBundle(this: PluginContext, bundle: OutputBundle, config:
109109
/** '[src^="./assets/"]' */
110110
, assetsSrcSelector = `[src^="${assetsDirWithBase}"]`
111111

112-
, fakeScript = `_vitePluginSinglefileCompression(${Date.now()})`
112+
, fakeScript = '_xxxxxxxx()'.replaceAll('x', () => '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$'.charAt(Math.random() * 64))
113113

114114
, globalDelete = new Set<string>()
115115
, globalDoNotDelete = new Set<string>()
@@ -178,7 +178,7 @@ async function generateBundle(this: PluginContext, bundle: OutputBundle, config:
178178
globalDoNotDelete.add(name)
179179
}
180180
// add script for load css
181-
allCSS += cssSource.replace(/\s*(\/\*[^*]*\*\/)?\s*$/, '')
181+
allCSS += cssSource.replace(/(\s*\/\*([^*]|\*(?!\/))*\*\/)*\s*$/, '')
182182
}
183183
// remove tag
184184
if (options.enableCompress)

0 commit comments

Comments
 (0)