Full Esm Support
Pure ESM Mode
Refer to this for more information about pure esm https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
Changes
- chore: change builder to rollup
- chore: remove unused files and folder
- fix(esm): make rules extensible in esm
This PR is change builder to rollup to make life easier. Before using rollup, the esm code generated by tsc is not fully supported in esm (package with type: "module"). For example
import Something from "../folder/module" //this is invalid in pure esm without flag
With rollup our code will automatically compiled to single code index.js and imported file will automatically transformed to explicit extension like this
import Something from "../folder/module.js" //YEAY, this is valid in pure esm without flag
This PR also refactor some code that not work in esm, for example
import * as Rules from "./rules"
Rules[x] = something // this will throw ERR: cannot add property unique, object is not extensible
So I make separate file rules.ts for list all rules and rules/index.ts to export object containing list of rules. Tested in my internal project
(PS: I was submit PR before to fix this extensible esm issue, but that PR break niv extend function, I guarantee this method is work and not break extend function)
I think this PR is not 100% ok. date after unit testing is still break. I don't know why. But this PR is good to start to make fully supported esm mode
esm support release: 5.0.0-beta.6