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

Apply single default for extensions across @compiled/babel-plugin, @compiled/webpack-loader and @compiled/parcel-transformer #1692

Open
dddlr opened this issue Jul 15, 2024 · 0 comments

Comments

@dddlr
Copy link
Collaborator

dddlr commented Jul 15, 2024

Discovered while working on #1689

At the moment the defaults for the extensions option are inconsistent.

  1. If resolver is not set in @compiled/webpack-loader or @compiled/parcel-transformer, then extensions will be passed to the default resolver, enhanced-resolver.
  2. This is also passed to @compiled/babel-plugin under the hood.

This can be a slight problem when extensions is not defined, and thus extensions falls back to its default value.

enhanced-resolver uses ['js', 'json', 'node'] as its default value, while @compiled/babel-plugin uses ['.js', '.jsx', '.ts', '.tsx'] as its default value.

This inconsistency is probably not intended and might catch people out.

We should perhaps use the same defaults for both enhanced-resolve and @compiled/babel-plugin - in other words, if extensions is not defined by the user, we should pass ['.js', '.jsx', '.ts', '.tsx']to bothenhanced-resolveand@compiled/babel-plugin`.

In addition, we should update the website documentation for these three packages once we fix this.

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

No branches or pull requests

1 participant