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

feat(check): allow using side effect imports with unknown module kinds (ex. css modules) #23392

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented Apr 16, 2024

This allows people to use imports like:

import "./app.css";

...with deno check in systems where there's a bundle step (ex. Vite). This will still error when using it with deno run or if the referenced file does not exist.

See test cases for behaviour.

@scarf005
Copy link
Contributor

would this behavior be configurable? for projects not using bundlers like vite, this might introduce subtle import bugs that might be only be found on runtime

@dsherret
Copy link
Member Author

would this behavior be configurable? for projects not using bundlers like vite, this might introduce subtle import bugs that might be only be found on runtime

@scarf005 Probably not. This change aligns more with TypeScript which already doesn't error for these kind of imports:

No compiler errors for importing files that exist and do not exist

This branch in Deno is still more strict than TypeScript:

Still compiler errors for importing files that do not exist

@scarf005
Copy link
Contributor

ah, so it will check for missing import. makes sense then.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dsherret dsherret merged commit 43c8c1c into denoland:main Apr 16, 2024
17 checks passed
@dsherret dsherret deleted the feat_check_side_effect_imports branch April 16, 2024 20:46
littledivy pushed a commit to littledivy/deno that referenced this pull request Apr 19, 2024
…s (ex. css modules) (denoland#23392)

This allows people to use imports like:

```ts
import "./app.css";
```

...with `deno check` in systems where there's a bundle step (ex. Vite).
This will still error when using it with `deno run` or if the referenced
file does not exist.

See test cases for behaviour.
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 this pull request may close these issues.

None yet

3 participants