DenoDDeno
Powered by
rabbit_rabbitR
Denoβ€’5mo ago
rabbit_rabbit

Https in Fresh 2 with Vite?

Hello! I'm in the process of upgrading from Fresh 1 to Fresh 2. I want to be able to run locally using https. It looks like http2.createSecureServer is not implemented in the latest deno yet? Thanks in advance!

deno task start
Task start vite
error when starting dev server:
Error [ERR_NOT_IMPLEMENTED]: Not implemented: http2.createSecureServer
    at notImplemented (ext:deno_node/_utils.ts:9:9)
    at createSecureServer (node:http2:1299:3)
    at resolveHttpServer (file:///Users/willweiss/dev/morehumaninternet/virtual-hospitals-africa/node_modules/.deno/vite@7.1.12_1/node_modules/vite/dist/node/chunks/config.js:18319:10)
    at eventLoopTick (ext:core/01_core.js:179:7)
    at async _createServer (file:///Users/willweiss/dev/morehumaninternet/virtual-hospitals-africa/node_modules/.deno/vite@7.1.12_1/node_modules/vite/dist/node/chunks/config.js:27953:45)
    at async CAC.<anonymous> (file:///Users/willweiss/dev/morehumaninternet/virtual-hospitals-africa/node_modules/.deno/vite@7.1.12_1/node_modules/vite/dist/node/cli.js:572:18)
deno task start
Task start vite
error when starting dev server:
Error [ERR_NOT_IMPLEMENTED]: Not implemented: http2.createSecureServer
    at notImplemented (ext:deno_node/_utils.ts:9:9)
    at createSecureServer (node:http2:1299:3)
    at resolveHttpServer (file:///Users/willweiss/dev/morehumaninternet/virtual-hospitals-africa/node_modules/.deno/vite@7.1.12_1/node_modules/vite/dist/node/chunks/config.js:18319:10)
    at eventLoopTick (ext:core/01_core.js:179:7)
    at async _createServer (file:///Users/willweiss/dev/morehumaninternet/virtual-hospitals-africa/node_modules/.deno/vite@7.1.12_1/node_modules/vite/dist/node/chunks/config.js:27953:45)
    at async CAC.<anonymous> (file:///Users/willweiss/dev/morehumaninternet/virtual-hospitals-africa/node_modules/.deno/vite@7.1.12_1/node_modules/vite/dist/node/cli.js:572:18)


My vite.config.ts looks like this

import { defineConfig } from 'vite'
import { fresh } from '@fresh/plugin-vite'
import tailwindcss from '@tailwindcss/vite'
import { promiseProps } from './util/promiseProps.ts'

const httpsOpts = await promiseProps({
  key: Deno.readTextFile('./local-certs/localhost.key'),
  cert: Deno.readTextFile('./local-certs/localhost.crt'),
})

export default defineConfig({
  plugins: [
    fresh(),
    tailwindcss(),
  ],
  server: {
    port: 8000,
    https: httpsOpts,
  },
})
import { defineConfig } from 'vite'
import { fresh } from '@fresh/plugin-vite'
import tailwindcss from '@tailwindcss/vite'
import { promiseProps } from './util/promiseProps.ts'

const httpsOpts = await promiseProps({
  key: Deno.readTextFile('./local-certs/localhost.key'),
  cert: Deno.readTextFile('./local-certs/localhost.crt'),
})

export default defineConfig({
  plugins: [
    fresh(),
    tailwindcss(),
  ],
  server: {
    port: 8000,
    https: httpsOpts,
  },
})
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

grpc / http2 / https in fresh.
LikoneLLikone / help
3y ago
https imports in vite project
hmtHhmt / help
2y ago
[Fresh] vite crashes with Broken Pipe error
vicaryVvicary / help
2mo ago
Vite dev server with HTTPS (node:http2)
Romuald QuantinRRomuald Quantin / help
11mo ago