-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
80 lines (76 loc) · 2.11 KB
/
webpack.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
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
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const fs = require('fs');
const isDevelopment = process.env.NODE_ENV !== 'production';
const devServerConfig = {
static: {
directory: path.join(__dirname, '/'),
publicPath: '/'
},
port: 443,
hot: true,
host: 'mutesky.app',
open: {
target: ['https://mutesky.app']
},
devMiddleware: {
publicPath: '/'
},
historyApiFallback: true
};
// Only add HTTPS configuration in development mode
if (isDevelopment) {
devServerConfig.server = {
type: 'https',
options: {
key: fs.readFileSync('mutesky.app+3-key.pem'),
cert: fs.readFileSync('mutesky.app+3.pem')
}
};
}
module.exports = {
mode: isDevelopment ? 'development' : 'production',
entry: {
main: './js/main.js'
},
output: {
filename: 'js/bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
clean: {
keep: /\.git/
}
},
devServer: devServerConfig,
resolve: {
extensions: ['.js'],
fallback: {
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
"buffer": require.resolve("buffer/"),
"util": require.resolve("util/"),
"path": false,
"fs": false
}
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser',
blueskyService: ['./js/bluesky.js', 'blueskyService']
}),
new CopyPlugin({
patterns: [
{ from: "index.html" },
{ from: "css", to: "css" },
{ from: "js", to: "js", globOptions: { ignore: ['**/main.js'] } },
{ from: "CNAME" },
{ from: "favicon.ico" },
{ from: "images", to: "images" },
{ from: "client-metadata.json" },
{ from: "callback.html" }
]
})
]
}