-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
58 lines (57 loc) · 1.63 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
/* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
const CopyPlugin = require('copy-webpack-plugin')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
module.exports = {
entry: {
background: path.join(__dirname, 'src/backgroundPage.ts'),
// content: path.join(__dirname, "src/contentScript.ts"),
popup: path.join(__dirname, 'src/popup/index.tsx'),
tab: path.join(__dirname, 'src/tab/index.tsx'),
},
output: {
path: path.join(__dirname, 'dist/js'),
filename: '[name].js',
},
plugins: [
new CopyPlugin({
patterns: [
{
from: path.resolve('./manifests/chrome-manifest.json'),
to: path.resolve('dist/manifest.json'),
},
],
}),
new NodePolyfillPlugin(),
],
module: {
rules: [
{
exclude: /node_modules/,
test: /\.tsx?$/,
use: 'ts-loader',
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {
'@src': path.resolve(__dirname, 'src/'),
'@tab': path.resolve(__dirname, 'src/tab/'),
url: 'iso-url',
stream: 'readable-stream', // cure general insanity
http: 'http-node', // chrome.sockets
dns: 'http-dns', // chrome.sockets
dgram: 'chrome-dgram', // chrome.sockets
net: 'chrome-net', // chrome.sockets
},
},
node: {
global: true, // https://github.com/webpack/webpack/issues/5627#issuecomment-394309966
// Buffer: true,
// fs: 'empty',
// tls: 'empty',
// cluster: 'empty', // expected by js-ipfs dependency: node_modules/prom-client/lib/cluster.js
},
}