-
-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
node_modules/remix-hono/build/handler.js:1
import { createRequestHandler } from "@remix-run/server-runtime";
^^^^^^
SyntaxError: Cannot use import statement outside a module
I can resolve this by adding "type": "module" to your package.json, but would you recommend some other solution like bundling the server?
I'm currently using node v18.9.0 in mjs mode like:
import { installGlobals, broadcastDevReady } from "@remix-run/node"
import { Hono } from "hono"
import { serve } from "@hono/node-server"
import * as rh from "remix-hono/handler"
import * as build from "./build/index.mjs"
installGlobals()
if (process.env.NODE_ENV === "development") broadcastDevReady(build)
const server = new Hono()
server.use(
"*",
rh.remix({
build,
mode: process.env.NODE_ENV,
// getLoadContext is optional, the default function is the same as here
getLoadContext(ctx) {
return ctx.env
},
})
)
serve(server, (info) => {
console.log(`Listening on http://localhost:${info.port}`) // Listening on http://localhost:3000
})Metadata
Metadata
Assignees
Labels
No labels