-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support default export and UMD (#301)
It’s possible to support both a CJS export and a `.default` property by defining the export as an interface that has a call expression and a default property. This makes it possible to use `import classNames from 'classnames'` or `classNames.default('')`. Also this packages exposes a UMD module, meaning `classNames` is available as a global when using a TypeScript script, but not when using a TypeScript module. This is supported by adding `export as namespace classNames`.
- Loading branch information
1 parent
1e53727
commit d52250f
Showing
4 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
import classNames = require('./index.js'); | ||
|
||
export as namespace classNames; | ||
|
||
export = classNames; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters