Exclude files from require.context of Webpack
You need to be aware after what part the negative lookahead employs it's rejection. If you do it right after the first forward slash it works fine.
And with that you want to reject .*test
after the slash, instead of just test
directly behind it.
/^(?!internals).*\/(?!.*test).*\.js$/
Or more specific not allowing internals
in the path name.
Nor ending with test.js
:
^(?!.*(?:internals|test.js$)).*\.js$