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
Docs: esm syntax #3253
Docs: esm syntax #3253
Conversation
@@ -21,6 +21,13 @@ yarn add fastify | |||
Let's write our first server: | |||
```js | |||
// Require the framework and instantiate it | |||
|
|||
// ESM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to share, would it be more straightforward for users get a table
esm | cjs |
---|---|
code | code |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this break the doc website? I will be hard to read on all devices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for curiosity, how the website would looks like with:
ESM
import Fastify from 'fastify'
const fastify = Fastify({
logger: true
})
Commonjs
const fastify = require('fastify')({
logger: true
})
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Adding ESM syntax to examples, as its the modern way to write JS these days.
This covers the main readme and the getting started example. Not sure if the whole documentation needs a patch
Checklist
npm run test
andnpm run benchmark
and the Code of conduct