File tree 2 files changed +41
-1
lines changed 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,36 @@ module.exports = {
164
164
165
165
Directory where the zipped browser extension should get created.
166
166
167
+ - ** artifactFilename**
168
+
169
+ - Type: ` Function `
170
+ - Default: `` ({name, version, mode}) => `${name}-v${version}-${mode}.zip` ``
171
+
172
+ Optional function to generate a custom artifact filename. Useful for naming builds for different browsers.
173
+
174
+ The function takes a single object parameter containing:
175
+ - ` name ` - Name from ` package.json `
176
+ - ` version ` - Version from ` package.json `
177
+ - ` mode ` - Vue CLI mode such as 'production'
178
+
179
+ For example,
180
+
181
+ ``` js
182
+ // vue.config.js
183
+ module .exports = {
184
+ pluginOptions: {
185
+ browserExtension: {
186
+ artifactFilename : ({ name, version, mode }) => {
187
+ if (mode === ' production' ) {
188
+ return ` ${ name} -v${ version} -${ process .env .BROWSER } .zip` ;
189
+ }
190
+ return ` ${ name} -v${ version} -${ process .env .BROWSER } -${ mode} .zip` ;
191
+ },
192
+ },
193
+ },
194
+ };
195
+ ```
196
+
167
197
### Component options
168
198
169
199
Some browser extension components have additional options which can be set as follows:
Original file line number Diff line number Diff line change @@ -100,10 +100,20 @@ module.exports = (api, options) => {
100
100
}
101
101
102
102
if ( isProduction ) {
103
+ let filename
104
+ if ( pluginOptions . artifactFilename ) {
105
+ filename = pluginOptions . artifactFilename ( {
106
+ name : packageJson . name ,
107
+ version : packageJson . version ,
108
+ mode : api . service . mode
109
+ } )
110
+ } else {
111
+ filename = `${ packageJson . name } -v${ packageJson . version } -${ api . service . mode } .zip`
112
+ }
103
113
webpackConfig . plugin ( 'zip-browser-extension' ) . use ( ZipPlugin , [
104
114
{
105
115
path : api . resolve ( pluginOptions . artifactsDir || 'artifacts' ) ,
106
- filename : ` ${ packageJson . name } -v ${ packageJson . version } - ${ api . service . mode } .zip`
116
+ filename : filename
107
117
}
108
118
] )
109
119
}
You can’t perform that action at this time.
0 commit comments