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 named exports output format #100

Merged
merged 2 commits into from
Jan 7, 2021
Merged

Conversation

LucaColonnello
Copy link

@LucaColonnello LucaColonnello commented Jan 6, 2021

This PR adds a namedExports option to the cli and the DtsCreator class.
This option formats the .d.ts output using named exports as opposed to a default export.

Why

When using css-modules, one of the various advantages is tree shaking offered by webpack or other compilers,
as the system knows first hand what you're using from your imports.

When enabling this css-modules feature (available in webpack's css-loader and style-loader),
the generated style modules will use named exports. This behaviour is not reflected in this module
as default exports are always used in the generated .d.ts.

Related to: #99

Luca Colonnello added 2 commits January 6, 2021 14:51
This option creates named exports in the output as opposed to using
a default export. This is intended to be used in combination with
the `namedExports` options in webpack's `css-loader` and
`style-loader` config, which enable proper tree shaking
of the final CSS.
@LucaColonnello LucaColonnello changed the title Named exports Add named exports output format Jan 6, 2021
@LucaColonnello LucaColonnello marked this pull request as ready for review January 6, 2021 15:48
@LucaColonnello LucaColonnello mentioned this pull request Jan 6, 2021
Copy link
Owner

@Quramy Quramy left a comment

Choose a reason for hiding this comment

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

LGTM

@Quramy
Copy link
Owner

Quramy commented Jan 7, 2021

@LucaColonnello Does this PR close #94 ?

@Quramy Quramy merged commit f7efbf2 into Quramy:master Jan 7, 2021
@LucaColonnello
Copy link
Author

@LucaColonnello Does this PR close #94 ?

This one does not, but I guess we could easily add 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

Successfully merging this pull request may close these issues.

2 participants