From ecb0b022912397bcf98550c1a783e9e0534f33e5 Mon Sep 17 00:00:00 2001 From: Ryan Christian <33403762+rschristian@users.noreply.github.com> Date: Thu, 21 Apr 2022 08:47:34 -0500 Subject: [PATCH] fix: babel exclude for hoisted modules (#947) * fix: Ensures hoisted node_modules are excluded by babel * docs: Adding changeset --- .changeset/hip-olives-allow.md | 5 +++++ src/index.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/hip-olives-allow.md diff --git a/.changeset/hip-olives-allow.md b/.changeset/hip-olives-allow.md new file mode 100644 index 00000000..fd808e26 --- /dev/null +++ b/.changeset/hip-olives-allow.md @@ -0,0 +1,5 @@ +--- +'microbundle': patch +--- + +Ensures hoisted node_modules are excluded from babel diff --git a/src/index.js b/src/index.js index f2ed30b0..c483152c 100644 --- a/src/index.js +++ b/src/index.js @@ -570,7 +570,8 @@ function createConfig(options, entry, format, writeMeta) { customBabel()({ babelHelpers: 'bundled', extensions: EXTENSIONS, - exclude: 'node_modules/**', + // use a regex to make sure to exclude eventual hoisted packages + exclude: /\/node_modules\//, passPerPreset: true, // @see https://babeljs.io/docs/en/options#passperpreset custom: { defines,