UNPKG

738 BJavaScriptView Raw
1/* eslint-disable global-require */
2/* eslint-disable import/no-dynamic-require */
3
4module.exports = function buildConfig(env) {
5 const config = require(`./config/webpack/lib-${env}.js`)({
6 context: __dirname,
7 entry: './src',
8 library: 'topcoder-react-utils',
9 });
10
11 /* The lib config is intended for use outside of this very package,
12 * so we need some tweaks here to make it work for this package itself. */
13 const babelLoader = config.module.rules.find(
14 x => x.loader === 'babel-loader',
15 );
16 babelLoader.options.presets[0] = `${__dirname}/config/babel/webpack`;
17
18 if (!config.module.noParse) config.module.noParse = [];
19 config.module.noParse.push(/src\/shared\/utils\/webpack\/require/);
20
21 return config;
22};