Add export default option
Hi there! I'm using this package and it all worked fine until the CI started complaining about:
ERROR: /home/travis/build/.../src/....css.d.ts: `export =` is not supported by @babel/plugin-transform-typescript
Please consider using `export <value>;`.
5 | readonly ellipsis: string
6 | }
> 7 | export = styles
| ^
8 |
Yup, we are using babel to transpile. It does not support the export assignment syntax which exist for backward compatibility with earlier versions of TypeScript (they probably refer to v.1.5, when they changed their understanding of modules).
I didn't want to introduce any breaking change, so I added an extra option to opt in for the default export declaration (that is the main workaround suggested by the babel folks; and it seems to be working fine) rather than the export assignment.
Let me know if you have any comment or feedbacks, happy to help and clarify!
@Quramy - Would be nice to merge this, otherwise the package is pretty much not usable (have to revert back to an older version).
I didn't want to introduce any breaking change, so I added an extra option to opt in for the default export declaration (that is the main workaround suggested by the babel folks; and it seems to be working fine) rather than the export assignment.
Would it really be a breaking change if you forced a default export declaration (without the option) or even setting the option to true by default? I mean, TypeScript will handle and work with both forms, for TypeScript this will be transparent, for everyone else, it will start working properly (so it's a bug fix, of sorts). Or am I wrong?
I didn't want to introduce any breaking change, so I added an extra option to opt in for the default export declaration (that is the main workaround suggested by the babel folks; and it seems to be working fine) rather than the export assignment.
Would it really be a breaking change if you forced a default export declaration (without the option) or even setting the option to true by default? I mean, TypeScript will handle and work with both forms, for TypeScript this will be transparent, for everyone else, it will start working properly (so it's a bug fix, of sorts). Or am I wrong?
Thinking about this and it looks to me that this project is not quite using semver yet (some breaking changes have been introduced in the past and the major version is still 0). As such and to simplify things, I would remove the exportDefault option altogether and force that as the default behavior. But not without changing styles to <basename> of the .css file, like #27 demonstrates. This would also help with #63.
What does everyone think?
Can we merge this PR?