forked from FakeFiller/fake-filler-extension
-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.ts
84 lines (80 loc) · 2.12 KB
/
webpack.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import * as path from "path";
import * as webpack from "webpack";
const autoprefixer = require("autoprefixer");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const cssnano = require("cssnano");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const webpackConfig: webpack.Configuration = {
cache: false,
entry: {
"service_worker": [
path.join(__dirname, "src/background/regeneratorRuntime.js"),
path.join(__dirname, "src/service_worker/index.ts")
],
"build/content-script": path.join(__dirname, "src/content_script/index.ts"),
"build/options": path.join(__dirname, "src/options/index.tsx"),
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "babel-loader",
exclude: /node_modules/,
},
{
test: /\.(scss)$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{
loader: "css-loader",
},
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: () => [autoprefixer(), cssnano()],
},
},
},
{ loader: "sass-loader" },
],
},
{
loader: "file-loader",
exclude: [/\.(html?)$/, /\.(ts|tsx|js|jsx)$/, /\.css$/, /\.scss$/, /\.json$/],
query: {
name: "[hash].[ext]",
outputPath: "media/",
publicPath: "build/",
},
},
],
},
output: {
filename: "[name].js",
path: path.join(__dirname, "dist"),
},
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new MiniCssExtractPlugin({
filename: "[name].css",
}),
new CopyWebpackPlugin({
patterns: [
{
context: "public",
from: "**/*",
to: path.join(__dirname, "dist/"),
},
],
}),
],
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx"],
alias: {
src: path.resolve(__dirname, "src"),
},
},
stats: "minimal",
};
export default webpackConfig;