Skip to content

Commit 7363954

Browse files
committed
Fixing failing production builds due to lack of key.pem file
1 parent ee3cd2a commit 7363954

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = (api) => {
1616
const outputDir = api.resolve(api.service.projectOptions.outputDir || 'dist')
1717
const packageScript = isProduction ? 'build-zip.js' : 'remove-evals.js'
1818
const hasOptionsPageEntry = fs.existsSync(api.resolve('./src/options/options.js'))
19+
const hasKeyFile = fs.existsSync(api.resolve('key.pem'))
1920

2021
api.configureWebpack((webpackConfig) => {
2122
webpackConfig.output.filename = '[name].js'
@@ -30,7 +31,11 @@ module.exports = (api) => {
3031
}
3132

3233
if (isProduction) {
33-
webpackConfig.plugins.push(new CopyWebpackPlugin([{ from: './key.pem', to: 'key.pem' }]))
34+
if (hasKeyFile) {
35+
webpackConfig.plugins.push(new CopyWebpackPlugin([{ from: './key.pem', to: 'key.pem' }]))
36+
} else {
37+
logger.warn('No `key.pem` file detected. This is problematic only if you are publishing an existing extension')
38+
}
3439
}
3540

3641
webpackConfig.plugins.push(new CopyWebpackPlugin([

0 commit comments

Comments
 (0)