48 lines
1 KiB
JavaScript
48 lines
1 KiB
JavaScript
|
const path = require("path");
|
||
|
|
||
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||
|
const CopyPlugin = require("copy-webpack-plugin");
|
||
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||
|
const ZipPlugin = require("zip-webpack-plugin");
|
||
|
|
||
|
module.exports = {
|
||
|
entry: {
|
||
|
popup: path.join(__dirname, "src", "js", "popup.ts"),
|
||
|
},
|
||
|
output: {
|
||
|
path: path.resolve(__dirname, "dist"),
|
||
|
filename: "[name].bundle.js",
|
||
|
},
|
||
|
mode: "development",
|
||
|
devtool: "inline-source-map",
|
||
|
module: {
|
||
|
rules: [
|
||
|
{
|
||
|
test: /\.html$/,
|
||
|
loader: "html-loader",
|
||
|
exclude: /node_modules/,
|
||
|
},
|
||
|
{
|
||
|
test: /\.tsx?$/,
|
||
|
use: "ts-loader",
|
||
|
exclude: /node_modules/,
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
plugins: [
|
||
|
new CleanWebpackPlugin(),
|
||
|
new CopyPlugin({
|
||
|
patterns: [{ from: path.resolve(__dirname, "src", "manifest.json") }],
|
||
|
}),
|
||
|
new HtmlWebpackPlugin({
|
||
|
template: path.join(__dirname, "src", "popup.html"),
|
||
|
filename: "popup.html",
|
||
|
chunks: ["popup"],
|
||
|
}),
|
||
|
new ZipPlugin({
|
||
|
filename: "addon",
|
||
|
extension: "xpi",
|
||
|
}),
|
||
|
],
|
||
|
};
|