vitejs/vite-plugin-basic-ssl

Options

geekact opened this issue · 5 comments

Add options to configure where needs ssl, for example:

ssl({
  server: true,
  preview: true,
});

Or just checking config

const https = { cert: '', key: '' };

if (config?.server.https === true) {
 // assign https
}
if (config?.preview.https === true) {
  // assign https
}

Library authors can't check if https is set when config?.server.https or config?.preview.https is not specified right? Why not specify it like?:

export default defineConfig({
  plugins: [basicSsl()],
  server: {
    https: true
  },
  preview: {
    https: true
  }
});

related: microsoft/playwright#19697

Library authors can't check if https is set when config?.server.https or config?.preview.https is not specified right? Would specify it instead like:

export default defineConfig({
  plugins: [basicSsl()],
  server: {
    https: true
  },
  preview: {
    https: true
  }
});

You are providing a new way and it just up to maintainers.

Yeah it's up to the maintainers. I'm just sharing some thoughts here :) It's not really a new way or do i miss something?: preview.https type: boolean | https.ServerOptions

Being able to set the proposed options or for the plugin to respect the user defined settings would be beneficial.
To address the issue, i created PR #16.

bluwy commented

This is fixed in #16