Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of CommonJS module format, use only ES Modules. #2102

Closed
Tracked by #2104
trusktr opened this issue Jun 24, 2023 · 3 comments · Fixed by #2106
Closed
Tracked by #2104

Get rid of CommonJS module format, use only ES Modules. #2102

trusktr opened this issue Jun 24, 2023 · 3 comments · Fixed by #2106

Comments

@trusktr
Copy link
Member

trusktr commented Jun 24, 2023

Feature request

The future is already here, and it is ES Modules. We currently build SSR to CommonJS, for example. CommonJS is outdated now, and we should move onto ES Modules and simplify our setup for all possible tooling that now understand the ES Module standard.

What problem does this feature solve?

We have legacy complexity. Move to modern standard.

What does the proposed API look like?

Remove any CommonJS (CJS) outputs, ensure everything is ES Modules (ESM).

Note, .eslintrc.cjs remains as CommonJS because current ESLint v8 doesn't support ESM in eslintrc. ESLint 9 will require the new "flat config" format, which will require ESM.

How should this be implemented in your opinion?

F.e. open rollup configs, don't output to cjs, output to esm.

Are you willing to work on this yourself?

Yes (PR #2106)

Is this a breaking change?

Yes, this update can possibly break any dev's tooling relying on old CJS. This will not break people who import Docsify with script tag, only people who build Docsify source code. We should provide a clear path in the release notes.

@trusktr
Copy link
Member Author

trusktr commented Jun 24, 2023

This change requires bumping the major version.

I strongly suggest we stop "saving a bunch of stuff" for a 5.0 release. We should organically perform the changes we need to perform to keep the project modern, and if that means we release this and it is the only reason to bump to version 5.0, then we release other breaking changes later to bump to 6.0, 7.0, etc, later, that would be totally fine.

We don't have the manpower and resources to coordinate a huge single breaking release, and IMO that has been holding us back.

Also, without making too many breaking changes at once, it will be easier for people to follow a migration path over time.

@trusktr trusktr changed the title Get rid of CommonJS module format. Get rid of CommonJS module format, use only ES Modules. Jun 24, 2023
@trusktr
Copy link
Member Author

trusktr commented Jun 24, 2023

I will re-place the original PR that I'd started at #1689 with a new one that maintains backwards compat.

@trusktr trusktr linked a pull request Jun 25, 2023 that will close this issue
9 tasks
@trusktr
Copy link
Member Author

trusktr commented Jun 25, 2023

PR: #2106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant