Skip to content

Instantly share code, notes, and snippets.

@sotnikov-link
Created July 30, 2020 03:50
Show Gist options
  • Save sotnikov-link/2bf2c25478207f61330bca050e509918 to your computer and use it in GitHub Desktop.
Save sotnikov-link/2bf2c25478207f61330bca050e509918 to your computer and use it in GitHub Desktop.
Transpile some node modules
/**
* @see https://github.com/babel/babel-loader/issues/171#issuecomment-464721341
*/
const transpileDependencies = ['regexpu-core'];
const include = new RegExp(
`node_modules/(${transpileDependencies.join('|')})/.*`
);
config.module.rules.push({
test: /\.js$/,
include,
use: [
{
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
// { modules: 'commonjs' }
],
],
},
},
],
});
console.dir(config.module.rules, { depth: null });
console.log({ include });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment