Webpack regex test for .js & .jsx
i know this is very old question but i had like to share my solution.
solved it like this
test: /\.(js|mjs|jsx|ts|tsx)$/,
so, .js & .jsx or ts, tsx and mjs
these all extensions are going to be match. Much more elegant. May it help someone.
Yes. test: /.jsx?$/
should be the right way. But you also need to set resolve.extensions
parameter to make it work.
module.exports = {
...
resolve: {
extensions: ['.js', '.jsx']
}
...
}