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

Add .mts and .cts support to tailwind.config or respect parent's package.json when loading TypeScript configuration files. #902

Open
1 of 2 tasks
JessicaSachs opened this issue Oct 8, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@JessicaSachs
Copy link

Describe the feature

I cannot avoid these errors unless I change my Tailwind config to be JavaScript with an explicit extension (tailwind.config.mjs) even though my project has "type": "module" declared.

Is it possible to properly respect the projects package.json's type or otherwise support the official TypeScript file extensions that match their JavaScript parallels?

Image

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?
@JessicaSachs JessicaSachs added the enhancement New feature or request label Oct 8, 2024
@JessicaSachs
Copy link
Author

JessicaSachs commented Oct 8, 2024

Workaround for some amount of Auto-complete support is to use JSDoc comments:

/**
 * See: https://github.com/nuxt-modules/tailwindcss/issues/902
 * @type { import("tailwindcss").Config }
 **/
export default {
  /* Autocomplete works within the configuration object */
}

@ineshbose
Copy link
Collaborator

Hi, thanks for opening this issue.

Regarding loading configuration, we use loadConfig from tailwindcss which uses jiti internally (but we may want to consider c12 for #808), and then for generating the configuration, we're still using CJS in the build directory (to be able to consistently require all syntaxes) - where would you be facing this issue?

Are we looking to add .mts, .cts here:

.map(path => path.startsWith(nuxtOptions.buildDir) ? path : findPath(path, { extensions: ['.js', '.cjs', '.mjs', '.ts'] })),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants