Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected "loaders" file extension parsing #52

Open
gavinsharp opened this issue Sep 2, 2021 · 0 comments · May be fixed by #53
Open

unexpected "loaders" file extension parsing #52

gavinsharp opened this issue Sep 2, 2021 · 0 comments · May be fixed by #53

Comments

@gavinsharp
Copy link

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

export const getExt = (str: string) => {
does not work the way I was expecting. For example, getExt('file.test.js') will return test.js. So I need to specify e.g.:

loaders: {
  '.test.js': 'jsx',
  '.js': 'jsx',
}

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.

@gavinsharp gavinsharp linked a pull request Sep 2, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant