mirror of
https://github.com/abhijithvijayan/web-extension-starter.git
synced 2025-10-07 07:22:37 +02:00
fix: browser specific packing (zip/crx/xpi) on build
This commit is contained in:
parent
6ac2a747c8
commit
f4fd3fb0e4
@ -14,6 +14,16 @@ const manifestInput = require('./src/manifest');
|
|||||||
const targetBrowser = process.env.TARGET_BROWSER;
|
const targetBrowser = process.env.TARGET_BROWSER;
|
||||||
const manifest = wextManifest[targetBrowser](manifestInput);
|
const manifest = wextManifest[targetBrowser](manifestInput);
|
||||||
|
|
||||||
|
const getExtensionFileType = () => {
|
||||||
|
if (targetBrowser === 'opera') {
|
||||||
|
return 'crx';
|
||||||
|
}
|
||||||
|
if (targetBrowser === 'firefox') {
|
||||||
|
return 'xpi';
|
||||||
|
}
|
||||||
|
return 'zip';
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
|
|
||||||
@ -35,7 +45,7 @@ module.exports = {
|
|||||||
new CleanWebpackPlugin({
|
new CleanWebpackPlugin({
|
||||||
cleanOnceBeforeBuildPatterns: [
|
cleanOnceBeforeBuildPatterns: [
|
||||||
path.join(process.cwd(), `extension/${targetBrowser}`),
|
path.join(process.cwd(), `extension/${targetBrowser}`),
|
||||||
path.join(process.cwd(), `extension/${targetBrowser}.zip`),
|
path.join(process.cwd(), `extension/${targetBrowser}.${getExtensionFileType()}`),
|
||||||
],
|
],
|
||||||
cleanStaleWebpackAssets: false,
|
cleanStaleWebpackAssets: false,
|
||||||
verbose: true,
|
verbose: true,
|
||||||
@ -117,7 +127,8 @@ module.exports = {
|
|||||||
}),
|
}),
|
||||||
new ZipPlugin({
|
new ZipPlugin({
|
||||||
path: path.resolve(__dirname, 'extension'),
|
path: path.resolve(__dirname, 'extension'),
|
||||||
filename: `${targetBrowser}.zip`,
|
extension: `${getExtensionFileType()}`,
|
||||||
|
filename: `${targetBrowser}`,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user