Basic https setup using an automatically generated self-signed certificate

Overview

@vitejs/plugin-basic-ssl npm

A plugin to generate untrusted certificates which still allows to access the page after proceeding a wall with warning.

In most scenarios, it is recommended to generate a secure trusted certificate instead and use it to configure server.https

Usage

// vite.config.js
import basicSsl from '@vitejs/plugin-basic-ssl'

export default {
  plugins: [
    basicSsl()
  ]
}

License

MIT

Comments
  • feat: change config hook to configResolved, avoid cacheDir different …

    feat: change config hook to configResolved, avoid cacheDir different …

    we can't get cacheDir config before config hook; to keep the same with other steps, change config hook to configResolved, so that we can get the whole config

    opened by PengBoUESTC 4
  • Incompatible with Vite 4.X.

    Incompatible with Vite 4.X.

    Peer dependency should be upgraded to Vite 4.

    npm ERR! Could not resolve dependency:
    npm ERR! peer vite@"^3.0.0-beta.0" from @vitejs/[email protected]
    npm ERR! node_modules/@vitejs/plugin-basic-ssl
    npm ERR!   dev @vitejs/plugin-basic-ssl@"^0.1.2" from the root project
    
    opened by okydk 3
  • Fix https object config error

    Fix https object config error

    Fix https://github.com/vitejs/vite-plugin-basic-ssl/issues/10, #7

    I'm not sure to understand why we need a lambda function generator, so I let it like that. Most likely to have two distinct objects, but I'm not quite sure how is it useful...

    opened by hugoattal 1
  • cacheDir path is missing the root path

    cacheDir path is missing the root path

    Hello. Looks like the cacheDir option in Vite config file is broken. I feel like the root option has been forgotten.

    {
      root: "./packages/application",
      cacheDir: ".cache"
    }
    

    It does save the certificate into /.cache instead of ./packages/application/.cache. Thanks.

    opened by cedeber 1
  • Doesn't work since 1.0

    Doesn't work since 1.0

    When accessing the server, we get -SSL_ERROR_NO_CYPHER_OVERLAP on Firefox -ERR_SSL_VERSION_OR_CIPHER_MISMATCH on Chrome

    It seems that this bug was introduce by this commit: https://github.com/vitejs/vite-plugin-basic-ssl/commit/8df71db382dff0dbf5aa442b3b68e77aaa6206f3

    The fix would be to change the line 12 from

    const https = () => ({ 
        https: { cert: certificate, key: certificate }
    })
    

    to this (else, the config would be written in config.server.https.https)

    const https = () => ({ cert: certificate, key: certificate });
    

    Though, I'm not sure about the arrow function writing... Could it just be this?

    const https = { cert: certificate, key: certificate };
    
    opened by hugoattal 0
  • Issue when using vite4

    Issue when using vite4

    Hi,

    I am using the below pasted vite.config.js for vite. When adding "basicSsl()" as Plugin vite does not respond to requests anymore. It causes 100% cpu load (single threaded) and can not be stopped besides killing it forcefully. Everything works fine, if basicssl is disabled and vite is being used via http. My Application is using VueJS 3.2.26. I've added my package.json further below.

    import { defineConfig } from 'vite'
    import vue from '@vitejs/plugin-vue'
    import basicSsl from '@vitejs/plugin-basic-ssl'
    
    // https://vitejs.dev/config/
    export default defineConfig({
      plugins: [vue()
    ,basicSsl()
    ],
      server: {
            host: true,
            port: '8080',
    
            }
    
    })
    
    
    
      "name": "hausverwaltung-client",
      "version": "0.0.0",
      "scripts": {
        "dev": "vite",
        "build": "vite build"
      },
      "dependencies": {
        "@vitejs/plugin-basic-ssl": "^1.0.1",
        "@vitejs/plugin-vue": "^4.0.0",
        "@vuepic/vue-datepicker": "^3.2.0",
        "axios": "^0.21.4",
        "serve": "^14.1.2",
        "vue": "^3.2.26",
        "vue-router": "^4.0.12"
      },
      "devDependencies": {
        "@vue/compiler-sfc": "^3.2.26",
        "vite": "^4.0.0"
      }
    }
    
    opened by sourcenux 0
  • Add option to generate a shared certificate + auto install it

    Add option to generate a shared certificate + auto install it

    So after talking a bit with @userquin, I suggest adding two features:

    The first time the plugin is launched in a project, as the user where he wants to generate the certificate:

    (x) Generate a project scoped certificate
    ( ) Use a shared certificate
    

    If the user chooses the shared certificate, ask him if he wants to install it

    Would you like to install this certificate to your OS? (y/N)
    

    I can work on this feature.

    opened by hugoattal 3
  • Options

    Options

    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
    }
    
    opened by geekact 3
  • Invalid certificate

    Invalid certificate

    I get this error :

    Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('https://127.0.0.1:5173/src/') with script ('https://127.0.0.1:5173/src/sw.ts'): An SSL certificate error occurred when fetching the script.

    And this is my vite.config.ts file : ` import { fileURLToPath, URL } from "node:url";

    import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; import basicSsl from '@vitejs/plugin-basic-ssl'

    // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), basicSsl() ], resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)), }, }, server: { https: true }, }); `

    Also, I have vue 3.2.45 and vite 3.2.4. And I launch the dev server with the command npm run dev -- --https

    opened by cyril-tl 0
  • Configure Renovate

    Configure Renovate

    Mend Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • .github/workflows/ci.yml (github-actions)
    • .github/workflows/release-tag.yml (github-actions)
    • package.json (npm)
    • playground/package.json (npm)

    Configuration

    🔡 Renovate has detected a custom config for this PR. Feel free to ask for help if you have any doubts and would like it reviewed.

    Important: Now that this branch is edited, Renovate can't rebase it from the base branch any more. If you make changes to the base branch that could impact this onboarding PR, please merge them manually.

    What to Expect

    With your current configuration, Renovate will create 11 Pull Requests:

    chore(deps): update dependency source-map to ^0.7.0
    • Schedule: ["at any time"]
    • Branch name: renovate/source-map-0.x
    • Merge into: main
    • Upgrade source-map to ^0.7.0
    chore(deps): update dependency unbuild to ^0.9.0
    • Schedule: ["at any time"]
    • Branch name: renovate/unbuild-0.x
    • Merge into: main
    • Upgrade unbuild to ^0.9.0
    chore(deps): update dependency vitest to ^0.25.0
    • Schedule: ["at any time"]
    • Branch name: renovate/vitest-monorepo
    • Merge into: main
    • Upgrade vitest to ^0.25.0
    chore(deps): update actions/checkout action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-checkout-3.x
    • Merge into: main
    • Upgrade actions/checkout to v3
    chore(deps): update actions/setup-node action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-setup-node-3.x
    • Merge into: main
    • Upgrade actions/setup-node to v3
    chore(deps): update dependency @​rollup/pluginutils to v5
    • Schedule: ["at any time"]
    • Branch name: renovate/rollup-pluginutils-5.x
    • Merge into: main
    • Upgrade @rollup/pluginutils to ^5.0.0
    chore(deps): update dependency execa to v6
    • Schedule: ["at any time"]
    • Branch name: renovate/execa-6.x
    • Merge into: main
    • Upgrade execa to ^6.0.0
    chore(deps): update dependency fs-extra to v11
    • Schedule: ["at any time"]
    • Branch name: renovate/fs-extra-11.x
    • Merge into: main
    • Upgrade fs-extra to ^11.0.0
    chore(deps): update dependency rollup to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/rollup-3.x
    • Merge into: main
    • Upgrade rollup to ^3.0.0
    chore(deps): update dependency slash to v5
    • Schedule: ["at any time"]
    • Branch name: renovate/slash-5.x
    • Merge into: main
    • Upgrade slash to ^5.0.0
    chore(deps): update dependency unbuild to v1
    • Schedule: ["at any time"]
    • Branch name: renovate/unbuild-1.x
    • Merge into: main
    • Upgrade unbuild to ^1.0.0

    🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
Releases(v1.0.1)
Owner
vite
vite
Light speed setup for MEVN(Mongo Express Vue Node) Apps

Light speed setup for MEVN stack based web-apps Chat: Telegram Donate: PayPal, Open Collective, Patreon A CLI tool for getting started with the MEVN s

madlabsinc 791 Dec 14, 2022
vite+vue3.2+setup+elementPlus+eslint+js+stylelint

前期准备工作,npm包和vscode配置 !!!很重要,关乎整个Vue3开发阶段的代码提示 Volar使用 使用Vue3开发需要禁用vscode插件Vetur 然后安装 Volar(Vue Language Features),这样Vue3代码提示即使是使用js开发也非常友好 如果volar没有任何

null 2 Feb 8, 2022
:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin

English | 简体中文 | 日本語 | Spanish SPONSORED BY 活动服务销售平台 客户消息直达工作群 Introduction vue-element-admin is a production-ready front-end solution for admin inter

花裤衩 80.1k Dec 31, 2022
Automatically detect and import components or modules

vite-plugin-autoimport Automatically detect and import components or modules. Motivation It's very common to have many components in one file as the p

Yuan Chuan 146 Dec 23, 2022
Automatically configure Vitest from your SvelteKit configuration.

vitest-svelte-kit Automatically configure Vitest from your SvelteKit configuration. Getting Started Installing In an existing SvelteKit project, run t

Nick Breaton 44 Dec 30, 2022
jump to local IDE source code while click the element of browser automatically.

?? Introduction A vite plugin which provides the ability that to jump to the local IDE when you click the element of browser automatically. It support

webfansplz 413 Dec 30, 2022
🐝 A vite plugin automatically export files & HMR support

vite-plugin-hot-export Automatically export files with HMR English|简体中文 Why ? When developing, we often need to download some images or svg from the i

Frozen FIsh 54 Nov 12, 2022
Mobile app development framework and SDK using HTML5 and JavaScript. Create beautiful and performant cross-platform mobile apps. Based on Web Components, and provides bindings for Angular 1, 2, React and Vue.js.

Onsen UI - Cross-Platform Hybrid App and PWA Framework Onsen UI is an open source framework that makes it easy to create native-feeling Progressive We

null 8.7k Jan 4, 2023
Vue Native is a framework to build cross platform native mobile apps using JavaScript

Vue Native Visit our website at vue-native.io or read the official documentation here. Build native mobile apps using Vue Vue Native is a framework to

GeekyAnts 8.4k Jan 6, 2023
Filter tests using substring

cypress-grep Filter tests using substring # run only tests with "hello" in their names npx cypress run --env grep=hello ✓ hello world - works -

Gleb Bahmutov 139 Dec 29, 2022
Resume maker made using React.

Rzume The ultimate tool for an exceptional resume. Create nothing but the best with us. Features ?? Professional templates Pick one from our many attr

Hemanth R 28 Oct 31, 2022
A template to use GoLang Lorca package to make desktop applications using webview and Svelte for the frontend,

Svelte Lorca Template A starter project for building modern cross-platform desktop apps in Go, HTML, and Svelte. This project is a fork of lorca-ts-re

Ben Winchester 16 Jun 19, 2022
A lib for loading PDF in Android using WebView

A lib for loading PDF in Android using WebView Usage Including in your project Copy... /pdf/src/main/assets/... all files in the path Use val settings

fuusy 197 Jan 4, 2023
A Svelte SPA Template for simple SPA Apps without using svelte kit.

Svelte SPA Template A Svelte Single Page Application Template for simple SPA Apps without using Svelte Kit or Sapper. New Project To create a new proj

ADITYA 1 Jan 24, 2022
Using Cypress with Vite, React, TypeScript, MSW and react-query

Vie + Cypress + MSW + react-query Demo Example of using Cypress with Vite, MSW and react-query. Uses the appReady pattern to signal to Cypress when th

Rob Caldecott 9 Jul 16, 2022
Third-Party Authentication (Github) demo Vue 3 + TypeScript + Pinia app using Supabase

vue-supabase-tpa-demo This template should help get you started developing with Vue 3 in Vite. Recommended IDE Setup VSCode + Volar (and disable Vetur

Mac (Maciej Pędzich) 25 Nov 21, 2022
Easily remove all refs from an object using the `deepUnref`-composable.

Vue - Deep Unrefs Similar to unref(), easily remove all refs recursively from an object using the deepUnref-composable. ?? Get Started Luckily, it's i

Open Web 4 May 19, 2022
Easily remove all refs from an object using the `deepUnref`-composable.

Vue - Deep Unrefs Similar to unref(), easily remove all refs recursively from an object using the deepUnref-composable. ?? Get Started Luckily, it's i

Open Web Foundation 4 May 19, 2022