Fix copy-webpack-plugin
This commit is contained in:
parent
97e47ad769
commit
d7e4a01adc
@ -3,39 +3,37 @@ const { compact } = require("lodash/fp")
|
|||||||
|
|
||||||
const baseConfig = require("./webpack.base.config")
|
const baseConfig = require("./webpack.base.config")
|
||||||
|
|
||||||
module.exports = env => {
|
module.exports = (env) => {
|
||||||
const config = baseConfig(env)
|
const config = baseConfig(env)
|
||||||
|
|
||||||
config.plugins.unshift(
|
config.plugins.unshift(
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin({
|
||||||
{
|
patterns: [
|
||||||
from: "src/manifest.json",
|
{
|
||||||
transform: function(content, _path) {
|
from: "src/manifest.json",
|
||||||
const manifest = JSON.parse(
|
transform: function (content, _path) {
|
||||||
content
|
const manifest = JSON.parse(
|
||||||
.toString()
|
content.toString().replace(/\[version\]/g, process.env.npm_package_version),
|
||||||
.replace(/\[version\]/g, process.env.npm_package_version)
|
)
|
||||||
)
|
return Buffer.from(
|
||||||
return Buffer.from(
|
JSON.stringify({
|
||||||
JSON.stringify({
|
...manifest,
|
||||||
...manifest,
|
permissions: compact([
|
||||||
permissions: compact([
|
...manifest.permissions,
|
||||||
...manifest.permissions,
|
env.NODE_ENV === "development" ? "http://*.mocoapp.localhost/*" : null,
|
||||||
env.NODE_ENV === "development"
|
]),
|
||||||
? "http://*.mocoapp.localhost/*"
|
options_ui: {
|
||||||
: null
|
...manifest.options_ui,
|
||||||
]),
|
chrome_style: true,
|
||||||
options_ui: {
|
},
|
||||||
...manifest.options_ui,
|
description: process.env.npm_package_description,
|
||||||
chrome_style: true
|
version: process.env.npm_package_version,
|
||||||
},
|
}),
|
||||||
description: process.env.npm_package_description,
|
)
|
||||||
version: process.env.npm_package_version
|
},
|
||||||
})
|
},
|
||||||
)
|
],
|
||||||
}
|
}),
|
||||||
}
|
|
||||||
])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
@ -9,7 +9,7 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
config.plugins.unshift(
|
config.plugins.unshift(
|
||||||
new CopyWebpackPlugin({
|
new CopyWebpackPlugin({
|
||||||
pattern: [
|
patterns: [
|
||||||
{
|
{
|
||||||
from: "src/manifest.json",
|
from: "src/manifest.json",
|
||||||
transform: function (content, _path) {
|
transform: function (content, _path) {
|
||||||
|
Loading…
Reference in New Issue
Block a user