Create web servers that run anywhere! ๐ documentation
Local development
Published under the MIT license.
Made by @pi0 and community ๐
๐ค auto updated with automd
Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
Home Page: https://nitro.unjs.io
License: MIT License
Create web servers that run anywhere! ๐ documentation
Published under the MIT license.
Made by @pi0 and community ๐
๐ค auto updated with automd
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are awaiting their schedule. Click on a checkbox to get an update now.
@cloudflare/workers-types
, @scalar/api-reference
, miniflare
, node
, pnpm
, undici
)These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
docs/package.json
undocs ^0.2.21
.devcontainer/devcontainer.json
node 20.13.1
.github/workflows/autofix.yml
actions/checkout v4
actions/setup-node v4
autofix-ci/action ea32e3a12414e6d3183163c3424a7d7a8631ad84
.github/workflows/ci.yml
actions/checkout v4
actions/setup-node v4
actions/checkout v4
actions/setup-node v4
oven-sh/setup-bun v1
package.json
@cloudflare/kv-asset-handler ^0.3.2
@netlify/functions ^2.7.0
@rollup/plugin-alias ^5.1.0
@rollup/plugin-commonjs ^25.0.8
@rollup/plugin-inject ^5.0.5
@rollup/plugin-json ^6.1.0
@rollup/plugin-node-resolve ^15.2.3
@rollup/plugin-replace ^5.0.5
@rollup/plugin-terser ^0.4.4
@rollup/pluginutils ^5.1.0
@types/http-proxy ^1.17.14
@vercel/nft ^0.27.1
archiver ^7.0.1
c12 ^1.10.0
chalk ^5.3.0
chokidar ^3.6.0
citty ^0.1.6
confbox ^0.1.7
consola ^3.2.3
cookie-es ^1.1.0
croner ^8.0.2
crossws ^0.2.4
db0 ^0.1.4
defu ^6.1.4
destr ^2.0.3
dot-prop ^9.0.0
esbuild ^0.21.4
escape-string-regexp ^5.0.0
etag ^1.8.1
fs-extra ^11.2.0
globby ^14.0.1
gzip-size ^7.0.0
h3 ^1.11.1
hookable ^5.5.3
httpxy ^0.1.5
ioredis ^5.4.1
is-primitive ^3.0.1
jiti ^1.21.0
klona ^2.0.6
knitwork ^1.1.0
listhen ^1.7.2
magic-string ^0.30.10
mime ^4.0.3
mlly ^1.7.0
mri ^1.2.0
node-fetch-native ^1.6.4
ofetch ^1.3.4
ohash ^1.1.3
openapi-typescript ^6.7.6
pathe ^1.1.2
perfect-debounce ^1.0.0
pkg-types ^1.1.1
pretty-bytes ^6.1.1
radix3 ^1.1.2
rollup ^4.18.0
rollup-plugin-visualizer ^5.12.0
scule ^1.3.0
semver ^7.6.2
serve-placeholder ^2.0.1
serve-static ^1.15.0
std-env ^3.7.0
ufo ^1.5.3
uncrypto ^0.1.3
unctx ^2.3.1
unenv ^1.9.0
unimport ^3.7.2
unstorage ^1.10.2
untyped ^1.4.2
unwasm ^0.3.9
@azure/functions ^3.5.1
@azure/static-web-apps-cli ^1.1.8
@biomejs/biome 1.7.3
@cloudflare/workers-types ^4.20240512.0
@deno/types ^0.0.1
@scalar/api-reference ^1.22.51
@types/archiver ^6.0.2
@types/aws-lambda ^8.10.138
@types/bun ^1.1.3
@types/estree ^1.0.5
@types/etag ^1.8.3
@types/fs-extra ^11.0.4
@types/node-fetch ^2.6.11
@types/semver ^7.5.8
@types/serve-static ^1.15.7
@types/xml2js ^0.4.14
@vitest/coverage-v8 ^1.6.0
automd ^0.3.7
better-sqlite3 ^11.0.0
changelogen ^0.5.5
edge-runtime ^2.5.10
eslint ^9.3.0
eslint-config-unjs 0.3.1
execa ^9.1.0
expect-type ^0.19.0
firebase-admin ^12.1.1
firebase-functions ^4.9.0
get-port-please ^3.1.2
miniflare ^3.20240512.0
prettier ^3.2.5
typescript ^5.4.5
unbuild ^2.0.0
undici ^6.18.1
vitest ^1.6.0
xml2js ^0.6.2
xml2js ^0.6.2
node ^16.11.0 || >=17.0.0
undici ^6.18.0
pnpm 9.1.2
NodeJS version : 14.16.2
Nitropack : 0.2.2
npm i pg
)import { Pool } from 'pg'
in a routeI have a problem when trying to import Pool
from 'pg', a postgres library to connect to a postgres database.
I get the following error :
SyntaxError: Named export 'Pool' not found. The requested module 'file:///project_root/node_modules/.pnpm/[email protected]/node_modules/pg/lib/index.js' is a CommonJS module, which may not support all module.exports as named exports.
Nitro then make the recommandation to use use the default export, however it still doesn't work, I get a typescript error : Module pg has no default export
.
Is there a way to get around the problem ? If no do you know any esm library for postgres ?
No response
No response
Dev server uses isolated worker threads. This prevents having shared cache that is preserved across reloads
Alternatively we can integrate with route caching rules for single preset
on nuxt3/bridge this leads to a 'Not ready!' being rendered rather than the initial page
Rework changes of nuxt/framework#1334
We can use the new isPublicAssetURL
for Cloudflare worker to avoid unnecessary try cache on getAssetFromKV
(example usage in service-worker)
When deploying a Nitro app with the azure-functions
preset, static Images such as .pngs and .jpgs are rendered incorrectly. (They are converted to string, which messes with their encoding.)
Issues to check:
context: nuxt/nuxt#12677
@danielroe https://nodejs.org/api/packages.html#resolving-user-conditions
currently probably only production and development fall into the category of conditions we'd support out-of-the-box, but the capacity to add more or customise them seems useful
Currently, we do use default module node import
and I think it is a viable default but allowing to extend woulnd't be a bad idea either
Most importantly prerender:route
hook which can be useful to modify and inspect pretender results. (eg: for service-worker to inject it's script)
Linked issue: nuxt/nuxt#13448
For now, it's purpose it to export and polyfill global $fetch
for Client/Universal builds.
Currently, we have some small dependencies that are only usable for some presets:
Their install size overhead is very small (3.4M non-shared!) but this can be a problem if we are more presets that require such dependencies. Currently we do not include any cli and suggest using npx
for tools such as wrangler
and miniflare
Once we had the ability to auto-install deps, we can come back to this as check cons/pros.
Also related: nuxt/nuxt#13166
h3 support: unjs/h3#68 is landed for Node.js compatible environments.
We might need to improve unenv mocks as well to universally make stream support available.
Currently waiting for h3 Event API to be completed and especially with Event class we can leverage native web API for sending streams.
List all possible API routes as /
or /_nitro
and another runtime state of nitro. This can be initially implemented as a devserver feature.
Use h3 + radix3 for handling API instead of middleware base
node --version
v16.14.2
https://github.com/X7md/nitropack-test
git clone https://github.com/X7md/nitropack-test
cd nitropack-test
npm install
# there is npm pkg @imagemagick/magick-wasm
Try to build using NITRO_PRESET=cloudflare npx nitropack build
, but I got this error
No response
<--- Last few GCs --->
[35531:0x5f79840] 15787 ms: Scavenge 2030.8 (2065.6) -> 2028.6 (2066.1) MB, 3.6 / 0.0 ms (average mu = 0.118, current mu = 0.110) allocation failure
[35531:0x5f79840] 15794 ms: Scavenge 2031.3 (2066.1) -> 2029.5 (2067.3) MB, 4.6 / 0.0 ms (average mu = 0.118, current mu = 0.110) allocation failure
[35531:0x5f79840] 15801 ms: Scavenge 2032.4 (2067.3) -> 2030.4 (2076.3) MB, 4.5 / 0.0 ms (average mu = 0.118, current mu = 0.110) allocation failure
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xb09980 node::Abort() [node]
2: 0xa1c235 node::FatalError(char const*, char const*) [node]
3: 0xcf784e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xcf7bc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xeaf465 [node]
6: 0xeaff46 [node]
7: 0xebe46e [node]
8: 0xebeeb0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xec1da5 v8::internal::Heap::HandleGCRequest() [node]
10: 0xe4f447 v8::internal::StackGuard::HandleInterrupts() [node]
11: 0x11fb805 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [node]
12: 0x15f0b19 [node]
Aborted (core dumped)```
Adding as a feature to route rules.
Refs:
TODO:
Improvements:
.nitrorc
routes.js
?heroku is very customisable but mostly this is done with buildpacks. Here's the node one.
By default the node buildpack will build, prune dev dependencies + package the entire app folder into a docker image. This is lots more space than Nitro needs. Options:
If you use the default heroku buildpack, you'll need to run heroku config:set HOST=0.0.0.0
Context: nuxt/nuxt#13586
Relevant upstream improvement: unjs/unenv#23
NodeJS: 17.19.0
@nuxt/nitro@npm:@nuxt/[email protected]
@nuxt/[email protected]
https://github.com/devind-team/eleden
But its not easy, because it need server.
This error is related to sockets, when on the client I establish a connection with the server via apollo-subscription.
In console I get:
And the page hangs in an endless reload.
And client does not set cookie. Before, on nuxt 2.5 it worked good.
I use apollo subscription.
No response
Context: nuxt/nuxt#13599
Proposal:
routes: {
'/public': { cors: true }
}
We probably need an h3 utility for this as well: unjs/h3#82
When dev
config is set, we need to force using nitro-dev
preset
No response
No response
A quick guide in advanced section about preset creation probably and ideally an starter template for POC.
Adding a contribution guide also for steps.
https://developers.cloudflare.com/workers/cli-wrangler/configuration#modules
Using this, we can natively use imports for chunks instead of using one entry (maybe behind a flag?)
An alternative might be using KV + eval but last time checked both eval
and importScripts
were forbidden due to security concerns they had. So it is probably the only way to use the native option.
Note: This is not replacing normal workers as is a paid service.
Looks like render.com does not have a separate setup for serverless/edge rendering: https://render.com/docs/web-services.
Setting up render was super-simple, and took only 30 sec. or so from creating an account to connecting the repository. This may just be a documentation task. (It deploys as a node server within a docker container.)
cc: @Atinux
@danielroe we have server timings for loading chunks but would be nice to know (particularly where we are performing internal $fetch) what the timings for each handler are
Context and how-to are not really clear to me at the moment but we might benefit from more nitro lifecycle hooks to make such a thing possible.
Related unjs/hookable#37
While generating pages, the crawler scans for href=""
links (filtering for local and without extension) This is the most straightforward way. We can allow the runtime to hint crawler with HTTP headers to crawl more with a header like X-Nitro-Prerender: link1, link2, ...
(the alternative is using standardLink:
header with prefetch strategy to infer this)
Supporting deno deploy: https://dash.deno.com/
It is actually almost possible via worker preset! We only need documentation and an official preset.
Operating System: Linux
Node Version: v17.1.0
Nuxt Version: 3.0.0-27319101.3e82f0f
Package Manager: [email protected]
Bundler: Vite
User Config: -
Runtime Modules: -
Build Modules: -
server/api/test.ts
import { v4 } from "uuid";
export default () => {
return v4();
};
Building the project causes the package uuid
to fail to be imported. The problem does not exist when running the dev server.
Cannot find module '/home/me/dev/nuxt3-app/.output/server/node_modules/uuid/wrapper.mjs' imported from /home/me/dev/nuxt3-app/.output/server/chunks/test.mjs
at new NodeError (node:internal/errors:371:5)
at finalizeResolution (node:internal/modules/esm/resolve:394:11)
at moduleResolve (node:internal/modules/esm/resolve:915:10)
at defaultResolve (node:internal/modules/esm/resolve:1005:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:475:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:245:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
at link (node:internal/modules/esm/module_job:78:36)
Moved from nuxt/nuxt#13040
No response
We can use renderDynamicImport (todo) to load async chunks for server-worker
target instead of using one chunk with either fetch+eval
or importScripts
. This will allow us deploying a real world app (like docus transformers) to static hosting without huge startup time.
Alternative: We can also use experimental ES worker modules (blog) but I think last time there was a chrome only support for this and firefox was unable
expose swagger compatible API from dev server based on handler defenitions.
macOS
v16.14.0
0.2.1
[email protected]
n/a
It would be a nice addition to nitro if there is be a possibility to change the response of static assets. Then it would also be possible to implement content encoding like brotli
or gzip
.
There does exist a discussion in the nuxt repo. https://github.com/nuxt/framework/discussions/3472
In addition to the discussion i already found the corresponding lines, which i changed in nuxt, in the nitro package:
https://github.com/unjs/nitro/blob/main/src/runtime/static.ts#L68
https://github.com/unjs/nitro/blob/main/src/rollup/plugins/public-assets.ts#L44
No response
I wrote a module which can handle the compression https://github.com/exreplay/nuxt-compression. This is still no official way and messes with the internal nitro code but there is no need to use patches.
Currently, we have unjs/server-placeholder for dev server that prevents unnecessary service calls. However, this can be useful for production as well. We only need to also ensure it will be configurable before spreading.
Built with node and a minimal generated docker image:
Dockerfile
docker
client CLI (alternative would be a JS client but is too much hassle)Note: It might improve heroku preset as well (#49)
Windows_NT
v16.13.1
3.0.0-27338323.1e98259
[email protected]
Vite
-
-
-
https://github.com/AlexDicy/nuxt-min-reproduction
Moved from nuxt/nuxt#13131
No response
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.