generated from effector/razzle-template
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrazzle.config.js
56 lines (49 loc) · 1.49 KB
/
razzle.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
const path = require('path');
const fs = require('fs');
const dotenv = require('dotenv');
dotenv.config();
module.exports = {
plugins: [
{
name: 'typescript',
options: {
useBabel: true,
},
},
'svg-react-component',
],
modifyWebpackConfig({ webpackConfig, env: { dev } }) {
if (dev) {
const CRT = path.resolve(__dirname, 'tls', 'cardbox.crt');
const KEY = path.resolve(__dirname, 'tls', 'cardbox.key');
let devServer;
try {
devServer = {
http2: true,
https: true,
cert: fs.readFileSync(CRT),
key: fs.readFileSync(KEY),
};
} catch (error) {
if (error.code === 'ENOENT') {
console.error(
`\n\n---------\n` +
`ERROR! No local certificates found in ./tls directory.\n` +
`Maybe you trying to start application without generating certificates first of all?\n` +
'You can fix this via running `$ ./scripts/create-certs.sh`, but before read Development section in README.md',
);
process.exit(-1);
}
throw error;
}
webpackConfig.devServer = {
...webpackConfig.devServer,
...devServer,
};
// webpackConfig.output.hashFunction = 'sha256';
}
webpackConfig.output.publicPath = webpackConfig.output.publicPath.replace('http://', '//');
webpackConfig.resolve.alias['@box'] = path.resolve(__dirname, 'src');
return webpackConfig;
},
};