-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.common.js
executable file
·62 lines (61 loc) · 1.79 KB
/
webpack.common.js
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
// const ChromeExtensionReloader = require("webpack-chrome-extension-reloader");
const ExtensionReloader = require("webpack-extension-reloader");
const CopyPlugin = require("copy-webpack-plugin");
const path = require("path");
module.exports = {
entry: {
"fast-find": path.join(__dirname, "src/FastFind.ts"),
"content-script": path.join(__dirname, "src/EntryPoint.ts"),
"browser-action": path.join(__dirname, "src/settings/index.ts"),
settings: path.join(__dirname, "src/settings/index.ts"),
background: path.join(__dirname, "src/Background.ts")
},
output: {
path: path.join(__dirname, "dist/"),
filename: "[name].js"
},
module: {
rules: [
{
exclude: /node_modules/,
test: /\.ts?$/,
use: "ts-loader"
},
{
exclude: /node_modules/,
test: /\.scss$/,
use: [
{
loader: "style-loader" // Creates style nodes from JS strings
},
{
loader: "css-loader" // Translates CSS into CommonJS
},
{
loader: "sass-loader" // Compiles Sass to CSS
}
]
}
]
},
resolve: {
extensions: [".ts", ".js"]
},
plugins: [
new ExtensionReloader({
port: 9090, // Which port use to create the server
reloadPage: true, // Force the reload of the page also
entries: {
// The entries used for the content/background scripts
contentScript: "index", // Use the entry names, not the file name or the path
background: "background" // *REQUIRED
}
}),
new CopyPlugin([
{ from: "src/icons", to: "./icons" },
{ from: "src/assets", to: "./assets" },
{ from: "src/settings", to: "./settings" },
{ from: "src/*.json", to: "./", flatten: true }
])
]
};