-
Notifications
You must be signed in to change notification settings - Fork 8
/
razzle.config.js
29 lines (26 loc) · 1004 Bytes
/
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
'use strict';
// in order for SSR to work, the react-native-web babel transform needs to be
// run on any code that references 'react-native'. So, we're overriding razzle's
// default "externals" configuration to also whitelist any deps that start with
// 'bs-react-native'. This will add those deps to the server bundle, but should
// also run the babel transform on them to switch 'react-native' --> 'react-native-web'
const nodeExternals = require('webpack-node-externals');
module.exports = {
modify: (config, { target, dev }) => {
if (target === 'node') {
config.externals = [
nodeExternals({
whitelist: [
dev ? 'webpack/hot/poll?300' : null,
/\.(eot|woff|woff2|ttf|otf)$/,
/\.(svg|png|jpg|jpeg|gif|ico)$/,
/\.(mp4|mp3|ogg|swf|webp)$/,
/\.(css|scss|sass|sss|less)$/,
mod => mod.indexOf('bs-react-native') === 0,
].filter(x => x),
}),
];
}
return config;
},
};