Skip to content

Commit

Permalink
🐛 Re-add trailing path delimiter to RegExp
Browse files Browse the repository at this point in the history
I had removed it in obahareth#13 (sorry, I had been struck by yarnpkg/yarn#4722)

The behaviour _with_ the trailing path delimiter is more correct, as without it in theory modules starting with the same name as a non-ES5 node_module would be unneccessarily transpiled.

This is all assuming the leading and trailing slash before obahareth#13 were meant as path delimiters and not RegExp delimiters, meaning that anyone wanting to use the RegExp would (and will) have to add surrounding slashes or `new RegExp()` manually, as in `/<place-output-here>/` or `new RegExp('<place-output-here>')` (personally, I'm writing the output of _are-you-es5_ to a file on _postinstall_ and read it into a `new RegExp()` in the webpack config).
  • Loading branch information
depoulo authored Jul 8, 2019
1 parent 47bd69b commit 06ea4e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/babel-loader-regex-builder.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function getBabelLoaderIgnoreRegex(dependencies: string[]) {
return `[\\/]node_modules[\\/](?!(${dependencies.join('|')}))`
return `[\\/]node_modules[\\/](?!(${dependencies.join('|')}))[\\/]`
}

0 comments on commit 06ea4e8

Please sign in to comment.