Update copy-webpack-plugin

This commit is contained in:
sienori 2021-04-06 17:52:14 +09:00
parent 7848a1d9e8
commit 7ca3711ad3
3 changed files with 77 additions and 71 deletions

View file

@ -20,7 +20,7 @@
"babel-loader": "^8.0.0-beta.3", "babel-loader": "^8.0.0-beta.3",
"babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-class-properties": "^6.24.1",
"clean-webpack-plugin": "^0.1.19", "clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^5.1.1", "copy-webpack-plugin": "^6.4.1",
"css-loader": "^3.5.3", "css-loader": "^3.5.3",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.5.0", "mini-css-extract-plugin": "^0.5.0",

View file

@ -130,7 +130,8 @@ module.exports = [
entry: { other: path.resolve(__dirname, `src/background/background.js`) }, entry: { other: path.resolve(__dirname, `src/background/background.js`) },
output: getOutput("copiedSource", config.tempDirectory), output: getOutput("copiedSource", config.tempDirectory),
plugins: [ plugins: [
new CopyWebpackPlugin([ new CopyWebpackPlugin({
patterns: [
{ {
from: `src`, from: `src`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/src/`) to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/src/`)
@ -171,7 +172,8 @@ module.exports = [
from: `webpack.utils.js`, from: `webpack.utils.js`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/webpack.utils.js`) to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/webpack.utils.js`)
} }
]), ]
}),
getZipPlugin(`copiedSource-${config.extName}-${ffExtVersion}`, config.distDirectory, "other/") getZipPlugin(`copiedSource-${config.extName}-${ffExtVersion}`, config.distDirectory, "other/")
] ]
} }

View file

@ -40,7 +40,8 @@ const getEntry = (sourceDir = "src") => {
}; };
const getCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src") => [ const getCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src") => [
new CopyWebpackPlugin([ new CopyWebpackPlugin({
patterns: [
{ {
from: `${sourceDir}/icons`, from: `${sourceDir}/icons`,
to: path.resolve(__dirname, `${outputDir}/${browserDir}/icons`) to: path.resolve(__dirname, `${outputDir}/${browserDir}/icons`)
@ -53,11 +54,13 @@ const getCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src") => [
from: `${sourceDir}/manifest-chrome.json`, from: `${sourceDir}/manifest-chrome.json`,
to: path.resolve(__dirname, `${outputDir}/${browserDir}/manifest.json`) to: path.resolve(__dirname, `${outputDir}/${browserDir}/manifest.json`)
} }
]) ]
})
]; ];
const getFirefoxCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src") => [ const getFirefoxCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src") => [
new CopyWebpackPlugin([ new CopyWebpackPlugin({
patterns: [
{ {
from: `${sourceDir}/icons`, from: `${sourceDir}/icons`,
to: path.resolve(__dirname, `${outputDir}/${browserDir}/icons`) to: path.resolve(__dirname, `${outputDir}/${browserDir}/icons`)
@ -70,7 +73,8 @@ const getFirefoxCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src")
from: `${sourceDir}/manifest-firefox.json`, from: `${sourceDir}/manifest-firefox.json`,
to: path.resolve(__dirname, `${outputDir}/${browserDir}/manifest.json`) to: path.resolve(__dirname, `${outputDir}/${browserDir}/manifest.json`)
} }
]) ]
})
]; ];
const getZipPlugin = (browserDir, outputDir = "dist", exclude = "") => const getZipPlugin = (browserDir, outputDir = "dist", exclude = "") =>