forked from jamaljsr/polar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rescriptsrc.js
45 lines (44 loc) · 1.39 KB
/
.rescriptsrc.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
const path = require('path');
module.exports = [
config => {
// set target on webpack config to support electron
config.target = 'electron-renderer';
// add support for hot reload of hooks
config.resolve.alias['react-dom'] = '@hot-loader/react-dom';
// https://github.com/websockets/ws/issues/1538#issuecomment-577627369
config.resolve.alias['ws'] = path.resolve(
path.join(__dirname, 'node_modules/ws/index.js'),
);
return config;
},
[
'use-babel-config',
{
presets: ['react-app'],
plugins: [
// babel optimizations for emotion styles
[
'@emotion',
{
// sourceMap is on by default but source maps are dead code eliminated in production
sourceMap: true,
autoLabel: 'always',
labelFormat: 'x-[local]',
cssPropOptimization: true,
},
],
// adds support for live hot reload
'react-hot-loader/babel',
],
},
],
config => {
// helper function to troubleshoot webpack config issues
RegExp.prototype.toJSON = RegExp.prototype.toString;
Function.prototype.toJSON = () => 'function() { }'; // Function.prototype.toString;
// uncomment the line below to log the webpack config to the console
// console.log(JSON.stringify(config.module.rules, null, 2));
// process.exit(1);
return config;
},
];