Convert to ES Module #8
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@nicolas-jaussaud Just wanted to let you know, I converted this library from CommonJS using
require
to ES Module format withimport
.It was necessary to edit all JS files - the tricky part was replacing dynamic require's, which often needed an additional
default
property when imported.I've tested all the available commands, so hopefully everything is still backward compatible with projects using this tool. If not, please feel free to open an issue.
This change will be helpful for keeping dependencies updated, which are all eventually moving to ES Module.
My short-term motivation was that the
sass
library started showing a deprecation notice about their legacy JS API, used by the Rollup plugin for styles (CSS/Sass). The legacy API will be removed in Dart Sass 2.0.As part of solving it, I replaced the plugin with a newer, better maintained fork. But one of its dependencies only works with ES Module - so I rolled up my sleeves and converted the entire library to ESM which I've been meaning to do for a while.