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-plugin-transform-class-properties": "^6.24.1",
"clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^5.1.1",
"copy-webpack-plugin": "^6.4.1",
"css-loader": "^3.5.3",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.5.0",

View file

@ -130,48 +130,50 @@ module.exports = [
entry: { other: path.resolve(__dirname, `src/background/background.js`) },
output: getOutput("copiedSource", config.tempDirectory),
plugins: [
new CopyWebpackPlugin([
{
from: `src`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/src/`)
},
{
from: `babel.config.js`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/babel.config.js`)
},
{
from: `config.json`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/config.json`)
},
{
from: `LICENSE`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/LICENSE`)
},
{
from: `package.json`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/package.json`)
},
{
from: `package-lock.json`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/package-lock.json`)
},
{
from: `README.md`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/README.md`)
},
{
from: `webpack.config.dev.js`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/webpack.config.dev.js`)
},
{
from: `webpack.config.dist.js`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/webpack.config.dist.js`)
},
{
from: `webpack.utils.js`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/webpack.utils.js`)
}
]),
new CopyWebpackPlugin({
patterns: [
{
from: `src`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/src/`)
},
{
from: `babel.config.js`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/babel.config.js`)
},
{
from: `config.json`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/config.json`)
},
{
from: `LICENSE`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/LICENSE`)
},
{
from: `package.json`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/package.json`)
},
{
from: `package-lock.json`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/package-lock.json`)
},
{
from: `README.md`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/README.md`)
},
{
from: `webpack.config.dev.js`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/webpack.config.dev.js`)
},
{
from: `webpack.config.dist.js`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/webpack.config.dist.js`)
},
{
from: `webpack.utils.js`,
to: path.resolve(__dirname, `${config.tempDirectory}/copiedSource/webpack.utils.js`)
}
]
}),
getZipPlugin(`copiedSource-${config.extName}-${ffExtVersion}`, config.distDirectory, "other/")
]
}

View file

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