liuweiGL / vite-plugin-mkcert

Provide certificates for vite's https dev service.
https://www.npmjs.com/package/vite-plugin-mkcert
MIT License
541 stars 37 forks source link

v1.10.0 BUG on vite dev server start (works fine with v1.9.0) #47

Closed pwoloszun closed 1 year ago

pwoloszun commented 1 year ago

It works fine with v1.9.0, BUT v1.10.0 throws this error:

error when starting dev server:
Error: Dynamic require of "fs" is not supported
    at file:///home/my-user/my-project/node_modules/vite-plugin-mkcert/dist/mkcert.mjs:13:9

My env info: npx envinfo --system --npmPackages vite,vite-plugin-mkcert --binaries

System:
    OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v16.16.0/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
  npmPackages:
    vite: ~3.1.3 => 3.1.3 
    vite-plugin-mkcert: 1.10.0 => 1.10.0 

vite.config.ts:

import { defineConfig } from 'vite';
import mkcert from 'vite-plugin-mkcert';

export default defineConfig({
  server: {
    https: true,
  },

  plugins: [mkcert()]
});
arunmmanoharan commented 1 year ago

I get a different error.

The "path" argument must be of type string or an instance of URL. Received undefined

image

VincentLandais commented 1 year ago

I am also facing this issue

Screenshot 2022-09-27 at 11 13 42
chrisrowe commented 1 year ago

Same, getting path error not fs though they seem interchangable.

cafesao commented 1 year ago

Same error here.

image

If you are facing this problem, for the time being the option is to get a replacement.

I recommend vite-plugin-basic-ssl

moalamri commented 1 year ago

Getting the same error, downgraded to v1.9.0 solved it

It seems like in the last update you switched from vite to esbuild which caused this problem, more info

chrisrowe commented 1 year ago

Thanks so much @liuweiGL

liuweiGL commented 1 year ago

:tada: This issue has been resolved in version 1.10.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

liuweiGL commented 1 year ago

:handshake: