From a02650e40ca6f165b99a7ef72f69196d05092f94 Mon Sep 17 00:00:00 2001 From: Maksim Sinik Date: Tue, 1 Nov 2022 14:57:39 +0100 Subject: [PATCH] Removes old Note about named imports in ESM (#4392) 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 }); ``` --- docs/Guides/Plugins-Guide.md | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/docs/Guides/Plugins-Guide.md b/docs/Guides/Plugins-Guide.md index e46fb1f980..de131b9242 100644 --- a/docs/Guides/Plugins-Guide.md +++ b/docs/Guides/Plugins-Guide.md @@ -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