Skip to content

Commit

Permalink
Removes old Note about named imports in ESM (#4392)
Browse files Browse the repository at this point in the history
As of today, you can import the named Fastify import in the ESM context with no issues.

Namely, this works as expected:
```
import { fastify } from "fastify";

const app = fastify({
  logger: true,
});

await app.listen({ port: 3000 });
```
  • Loading branch information
fox1t committed Nov 1, 2022
1 parent 3ba44ce commit a02650e
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions docs/Guides/Plugins-Guide.md
Expand Up @@ -439,24 +439,6 @@ async function plugin (fastify, opts) {

export default plugin
```
__Note__: Fastify does not support named imports within an ESM context. Instead,
the `default` export is available.

```js
// server.mjs
import Fastify from 'fastify'

const fastify = Fastify()

///...

fastify.listen({ port: 3000 }, (err, address) => {
if (err) {
fastify.log.error(err)
process.exit(1)
}
})
```

## Handle errors
<a id="handle-errors"></a>
Expand Down

0 comments on commit a02650e

Please sign in to comment.