I am trying to add all files from module subdirectory to Webpack externals. Especially data of react-intl locale files.
I am tryng to specify a path to the locale files with a regexp in a webpack config, but it does't work:
module.exports = {
//...
externals: [
/react-intl\/locale-data\/.*/,
// ...
]
};
I am loading those files dynamically, is there a problem?
const localeData = require(`react-intl/locale-data/${language.getLocale()}`);
Every dependency is correctly externalized, except those locale files: Webpack bundle