Skip to content

Commit

Permalink
perf: use node: prefix to bypass require.cache call for builtins (#190
Browse files Browse the repository at this point in the history
)

* perf: use `node:` prefix to bypass require.cache call for builtins

See fastify/fastify-static#407

* docs: use `node:` prefix to bypass require.cache call for builtins
  • Loading branch information
Fdawgs authored Sep 10, 2023
1 parent 8f810e6 commit 7905913
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ If you need to run a middleware only under certain path(s), just pass the path a

```js
const fastify = require('fastify')()
const path = require('path')
const path = require('node:path')
const serveStatic = require('serve-static')

fastify
Expand All @@ -167,7 +167,7 @@ You can also use the engine itself without the Fastify plugin system.
## Usage
```js
const Middie = require('@fastify/middie/engine')
const http = require('http')
const http = require('node:http')
const helmet = require('helmet')
const cors = require('cors')

Expand Down
4 changes: 2 additions & 2 deletions test/engine.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const middie = require('../lib/engine')
const t = require('tap')
const http = require('http')
const { join } = require('path')
const http = require('node:http')
const { join } = require('node:path')
const serveStatic = require('serve-static')
const test = t.test

Expand Down
2 changes: 1 addition & 1 deletion test/middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const fastify = require('fastify')
const fp = require('fastify-plugin')
const cors = require('cors')
const helmet = require('helmet')
const fs = require('fs')
const fs = require('node:fs')

const middiePlugin = require('../index')

Expand Down

0 comments on commit 7905913

Please sign in to comment.