File tree Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,14 @@ export function removeDuplicates(arr: any): any[] {
77}
88
99export async function transform ( {
10+ minify,
1011 file,
1112 name,
1213 loader
1314} : Transform ) : Promise < string > {
1415 const { code } = await transformWithEsbuild ( file , name , {
16+ minify,
1517 loader,
16- minify : true ,
1718 sourcemap : false ,
1819 legalComments : 'none'
1920 } )
Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ export default function UserscriptPlugin(
146146 let source = readFileSync ( outPath , 'utf8' )
147147 source = source . replace ( styleTemplate , `${ css . inject ( ) } ` )
148148 source = await transform ( {
149+ minify : ! isBuildWatch ,
149150 file : source ,
150151 name : fileName ,
151152 loader : 'js'
@@ -161,6 +162,7 @@ export default function UserscriptPlugin(
161162 const wsFile = readFileSync ( resolve ( pluginDir , 'ws.js' ) , 'utf8' )
162163
163164 const wsScript = await transform ( {
165+ minify : ! isBuildWatch ,
164166 file : wsFile . replace ( '__WS__' , `ws://localhost:${ port } ` ) ,
165167 name : wsPath ,
166168 loader : 'js'
Original file line number Diff line number Diff line change 11import { GM , GMwindow } from './constants.js'
22
33export interface Transform {
4+ minify : boolean
45 file : string
56 name : string
67 loader : 'js' | 'css'
You can’t perform that action at this time.
0 commit comments