-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebextension-toolbox.config.js
42 lines (38 loc) · 1.13 KB
/
webextension-toolbox.config.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
/* global require */
const path = require("path");
const webpack = require("webpack");
/* global module */
module.exports = {
webpack: (config, { dev, vendor }) => {
config.module = {
...config.module,
rules: [
...config.module.rules,
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: "asset/resource",
},
],
};
// TODO: should we drop the aliases and just use actual relative paths? if not, should we alias the `scripts` directory instead? (would also need to update jsconfig.json to match)
config.resolve = {
alias: {
utils: path.resolve(__dirname, "app/scripts/utils/"),
},
extensions: [".js", ".json", ".jsx"],
};
// TODO: it would be nice to drop the polyfill, but it seems chrome still only recognizes the `chrome` namespace...
if (["chrome", "opera", "edge"].includes(vendor)) {
config.plugins.push(
new webpack.ProvidePlugin({
browser: "webextension-polyfill",
})
);
}
return config;
},
};