mocoapp-browser-extension/webpack.firefox.config.js
dependabot-preview[bot] 97e47ad769
Bump copy-webpack-plugin from 5.1.1 to 6.0.2 (#160)
* Bump copy-webpack-plugin from 5.1.1 to 6.0.2

Bumps [copy-webpack-plugin](https://github.com/webpack-contrib/copy-webpack-plugin) from 5.1.1 to 6.0.2.
- [Release notes](https://github.com/webpack-contrib/copy-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/copy-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/copy-webpack-plugin/compare/v5.1.1...v6.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Update copy-webpack-plugin

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Manuel Bouza <manuel@bouza.ch>
2020-06-04 23:29:06 +02:00

47 lines
1.3 KiB
JavaScript

const uuidv4 = require("uuid/v4")
const CopyWebpackPlugin = require("copy-webpack-plugin")
const { compact } = require("lodash/fp")
const baseConfig = require("./webpack.base.config")
module.exports = (env) => {
const config = baseConfig(env)
config.plugins.unshift(
new CopyWebpackPlugin({
pattern: [
{
from: "src/manifest.json",
transform: function (content, _path) {
const manifest = JSON.parse(
content.toString().replace(/\[version\]/g, process.env.npm_package_version),
)
return Buffer.from(
JSON.stringify({
...manifest,
permissions: compact([
...manifest.permissions,
env.NODE_ENV === "development" ? "http://*.mocoapp.localhost/*" : null,
]),
options_ui: {
...manifest.options_ui,
browser_style: true,
},
browser_specific_settings: {
gecko: {
id: process.env.APPLICATION_ID || `{${uuidv4()}}`,
},
},
description: process.env.npm_package_description,
version: process.env.npm_package_version,
}),
)
},
},
],
}),
)
return config
}