Skip to content

crxjs does not support HTTPS flag in vite #852

@kaminskypavel

Description

@kaminskypavel

Build tool

Vite

Where do you see the problem?

  • In the browser
  • In the terminal

Describe the bug

I have a content-script running on a https website, settings https flag on vite config is being ignored.

Reproduction

in vite.config.ts

  server: {
    https: true,   <--------------
    port: 5173,
    hmr: {
      clientPort: 5173
    },
    proxy: {
      '/api': {
        target: 'http://localhost:3010',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    },
  },
})

and results in an error

Service worker registration failed. Status code: 3

  "background": {
    "service_worker": "service-worker-loader.js",
    "type": "module"
  },

I believe this has to do with the encoded value in plugin-background.ts

if you can confirm this is the case i don't mind submitting a PR

Logs

No response

System Info

System:
    OS: Windows 11
    CPU: (16) x64 Intel(R) Core(TM) i7-10870H CPU @ 2.20GHz
    Memory: 41 GB / 63 GB
  Binaries:
    Node: 20.7.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.12.0 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (120.0.2210.91)

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions