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

Support named exports #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

danieljuhl
Copy link
Contributor

Closes #37

It has one known limitation. Exported class names has to JS safe - eg. we can't use dash in class names.

@danieljuhl
Copy link
Contributor Author

danieljuhl commented Mar 14, 2020

If the concept / design is accepted, I'm happy to create tests and documentation.

The default behaviour was changed in #9, but I suggest to add this as a feature, and let the user of this plugin decide, if they want default or named exports (with its limitations).

@laverdet
Copy link

I submitted a bug report to TypeScript about lack of support for string literal exports, since this is a feature in plain JavaScript: microsoft/TypeScript#56200

@laverdet
Copy link

Got a comment with a pointer to another issue. I believe you can export raw string names via export = . I'll give it a shot in our project and follow up later.

laverdet added a commit to laverdet/css-modules-typescript-loader that referenced this pull request Oct 24, 2023
BREAKING CHANGE: Updates the declaration template.

This is a followup on seek-oss#38

The `exports =` declaration was added in e7342df but removed in
908d491 due some issue in babel which I can't reproduce. Maybe that
has been fixed downstream in the meantime.

Due to microsoft/TypeScript#40594 we cannot export these names directly
since class names might not be valid JavaScript identifiers, even though
they are valid exported names. When that TypeScript bug is resolved this
can be changed to export the names directly instead of using `export =`.
The problem with `export =` is that it will let you do `import * as css
from ...` in addition to `import css from ...` even though only
`import *` will work.
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.

Support named exports
2 participants