74 lines
1.5 KiB
JavaScript
74 lines
1.5 KiB
JavaScript
const webpack = require("webpack");
|
|
const path = require("path");
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
|
|
const config = {
|
|
entry: {
|
|
popup: path.join(__dirname, "src/popup.jsx"),
|
|
},
|
|
output: { path: path.join(__dirname, "dist"), filename: "[name].js" },
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
use: "babel-loader",
|
|
exclude: /node_modules/,
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ["style-loader", "css-loader"],
|
|
exclude: /\.module\.css$/,
|
|
},
|
|
{
|
|
test: /\.ts(x)?$/,
|
|
loader: "ts-loader",
|
|
exclude: /node_modules/,
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: [
|
|
"style-loader",
|
|
{
|
|
loader: "css-loader",
|
|
options: {
|
|
importLoaders: 1,
|
|
modules: true,
|
|
},
|
|
},
|
|
],
|
|
include: /\.module\.css$/,
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
use: "file-loader",
|
|
},
|
|
{
|
|
test: /\.png$/,
|
|
use: [
|
|
{
|
|
loader: "url-loader",
|
|
options: {
|
|
mimetype: "image/png",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
extensions: [".js", ".jsx", ".tsx", ".ts"],
|
|
alias: {
|
|
"react-dom": "@hot-loader/react-dom",
|
|
},
|
|
},
|
|
devServer: {
|
|
contentBase: "./dist",
|
|
},
|
|
plugins: [
|
|
new CopyPlugin({
|
|
patterns: [{ from: "public", to: "." }],
|
|
}),
|
|
],
|
|
};
|
|
|
|
module.exports = config;
|