Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

[Improvement] Usage of ESM imports instead of CommonJS #27

Closed
theoludwig opened this issue Apr 22, 2021 · 5 comments
Closed

[Improvement] Usage of ESM imports instead of CommonJS #27

theoludwig opened this issue Apr 22, 2021 · 5 comments
Assignees
Labels
blocked improvement Improve structure/format/performance/refactor/tests of the code

Comments

@theoludwig
Copy link
Member

theoludwig commented Apr 22, 2021

Proposal

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

@theoludwig theoludwig added the improvement Improve structure/format/performance/refactor/tests of the code label Apr 22, 2021
@theoludwig theoludwig self-assigned this Apr 22, 2021
@theoludwig theoludwig added this to the v4.0.0 milestone Apr 22, 2021
@github-actions
Copy link

🎉 This issue has been resolved in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@theoludwig
Copy link
Member Author

Reverted as v4.0.1.

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

@theoludwig theoludwig removed this from the v4.0.0 milestone Aug 16, 2021
@lunelson
Copy link

lunelson commented Sep 8, 2021

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

@theoludwig
Copy link
Member Author

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.

@lunelson
Copy link

lunelson commented Sep 9, 2021

Cool 👍.

@theoludwig theoludwig closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked improvement Improve structure/format/performance/refactor/tests of the code
Projects
None yet
Development

No branches or pull requests

2 participants