if I want both *.test.js and *.js files to use the JSX loader. And I would need to do this for any other "double extension" (e.g. *.story.js, etc.). I would expect loaders: { '.js': 'jsx' } to be sufficient here.
Is there a reason the getExt helper behaves this way? I think it's fairly unexpected and differs from e.g. path.extname behaviour.
I was trying to configure the loader used for all
.js
files, because I need to use the JSX parser for.js
due to legacy constraints.However, the
getExt
logic from https://github.com/aelbore/esbuild-jest/blob/daa5847b3b382d9ddf6cc26e60ad949d202c4461/src/utils.ts#L5 does not work the way I was expecting. For example,getExt('file.test.js')
will returntest.js
. So I need to specify e.g.:if I want both
*.test.js
and*.js
files to use the JSX loader. And I would need to do this for any other "double extension" (e.g.*.story.js
, etc.). I would expectloaders: { '.js': 'jsx' }
to be sufficient here.Is there a reason the
getExt
helper behaves this way? I think it's fairly unexpected and differs from e.g.path.extname
behaviour.