@@ -46,6 +46,12 @@ const pkg = require(resolve(`package.json`))
4646const packageOptions = pkg . buildOptions || { }
4747const name = packageOptions . filename || path . basename ( packageDir )
4848
49+ const banner = `/**
50+ * ${ pkg . name } v${ masterVersion }
51+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
52+ * @license MIT
53+ **/`
54+
4955const [ enumPlugin , enumDefines ] = inlineEnums ( )
5056
5157/** @type {Record<PackageFormat, OutputOptions> } */
@@ -136,11 +142,7 @@ function createConfig(format, output, plugins = []) {
136142 ( isGlobalBuild || isBrowserESMBuild || isBundlerESMBuild ) &&
137143 ! packageOptions . enableNonBrowserBranches
138144
139- output . banner = `/**
140- * ${ pkg . name } v${ masterVersion }
141- * (c) 2018-present Yuxi (Evan) You and Vue contributors
142- * @license MIT
143- **/`
145+ output . banner = banner
144146
145147 output . exports = isCompatPackage ? 'auto' : 'named'
146148 if ( isCJSBuild ) {
@@ -372,24 +374,21 @@ function createMinifiedConfig(/** @type {PackageFormat} */ format) {
372374 {
373375 name : 'swc-minify' ,
374376
375- async renderChunk (
376- contents ,
377- _ ,
378- { format, sourcemap, sourcemapExcludeSources } ,
379- ) {
380- const { code, map } = await minifySwc ( contents , {
377+ async renderChunk ( contents , _ , { format } ) {
378+ const { code } = await minifySwc ( contents , {
381379 module : format === 'es' ,
380+ format : {
381+ comments : false ,
382+ } ,
382383 compress : {
383384 ecma : 2016 ,
384385 pure_getters : true ,
385386 } ,
386387 safari10 : true ,
387388 mangle : true ,
388- sourceMap : ! ! sourcemap ,
389- inlineSourcesContent : ! sourcemapExcludeSources ,
390389 } )
391390
392- return { code, map : map || null }
391+ return { code : banner + code , map : null }
393392 } ,
394393 } ,
395394 ] ,
0 commit comments