Thream/styled-jsx-plugin-sass

[Improvement] Usage of ESM imports instead of CommonJS

theoludwig opened this issue ยท 5 comments

Proposal

We should use ESM imports instead of CommonJS.
See: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

๐ŸŽ‰ This issue has been resolved in version 4.0.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

Reverted as v4.0.1.

See: #68 and vercel/styled-jsx#733

I'm not sure why this would be an improvement... the sass JavaScript API is still commonjs ๐Ÿค” ?

I'm not sure why this would be an improvement... the sass JavaScript API is still commonjs ๐Ÿค” ?

There are many advantages to use ESM imports instead of CommonJS :

  • It uses 'use strict' by default
  • You can use Top-level await
  • Import both default export and named exports in the same statement

And the most important advantage in my opinion is that it is unified, as soon as the whole JavaScript ecosystem will migrate to full ESM (it will still probably take few years), it will be easier to code in JavaScript, as you will not need to learn 2 syntax to do the same thing, it's just seems that ESM is THE way to do it, as it is in the ECMAScript specification.

Fundamentally, it doesn't change much for this small npm package.
This change is only a "refactor" thing to ease the maintenance but not at all an improvement for users using the package, so this issue is not a priority of course.

Cool ๐Ÿ‘.