-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
32 lines (31 loc) · 1.06 KB
/
next.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
// Update these to match your package scope name.
const internalNodeModulesRegExp = /(?:react-native-tab-view)(?!.*node_modules)/;
const externalNodeModulesRegExp = /node_modules(?!\/(?:react-native-tab-view)(?!.*node_modules))/;
module.exports = {
webpack: (config, { dev, isServer, defaultLoaders }) => {
config.resolve.symlinks = false;
config.externals = config.externals.map(external => {
if (typeof external !== 'function') return external;
return (ctx, req, cb) =>
internalNodeModulesRegExp.test(req) ? cb() : external(ctx, req, cb);
});
config.module.rules.push({
test: /\.+(js|jsx)$/,
loader: defaultLoaders.babel,
include: [internalNodeModulesRegExp],
});
config.resolve.alias = {
...config.resolve.alias,
'react-native$': 'react-native-web',
};
config.resolve.extensions = ['.web.js', '.js'];
return config;
},
webpackDevMiddleware: config => {
config.watchOptions.ignored = [
...config.watchOptions.ignored,
externalNodeModulesRegExp,
];
return config;
},
};