Skip to content

esbuild-style-plugin can cause type issues for sass #7430

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

Closed
mattrunyon opened this issue May 29, 2025 · 0 comments · Fixed by #7407
Closed

esbuild-style-plugin can cause type issues for sass #7430

mattrunyon opened this issue May 29, 2025 · 0 comments · Fixed by #7407

Comments

@mattrunyon
Copy link

Problem

The dependency esbuild-style-plugin installs @types/sass: ^1.43.1. This currently resolves to 1.45.0 which is a deprecation version that doesn't actually include any type files. In our project, this was causing typescript errors because it is trying to load the types from @types/sass globally since we didn't change a default tsconfig option.

The error message we received

error TS2688: Cannot find type definition file for 'sass'.
   The file is in the program because:
     Entry point for implicit type library 'sass'

Someone opened a PR to remove the types dependency, but it seems esbuild-style-plugin is abandoned. g45t345rt/esbuild-style-plugin#28

Potential Solution

I think moving esbuild-style-plugin to a dev dependency will prevent others from running into this. I'm not sure why it would need to be a regular dependency as there are other esbuild plugins as dev dependencies already in plotly.js.

Workaround/Fix for users

For anybody looking for a fix that doesn't need an update from plotly, we needed to add "types": ["node", "jest"] to compilerOptions in our tsconfig.json. This prevents the default behavior of looking at every @types module for global declarations which was causing the type error. In our case we only reference process and the Jest globals. You might need to add additional types depending on your project.

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