crxjs / chrome-extension-tools

Bundling Chrome Extensions can be pretty complex. It doesn't have to be.
https://crxjs.dev/vite-plugin
2.71k stars 181 forks source link

Under Windows system, the packaging result does not include the public directory #716

Open zf1998 opened 1 year ago

zf1998 commented 1 year ago

Build tool

Vite

Where do you see the problem?

Describe the bug

I used the Windows system for packaging, but there was no public directory in the packaging results. Looking at the source code, it's probably here. image The 'publicDir' path does not match expectations

Reproduction

Clone this respository " https://github.com/mubaidr/vite-vue3-chrome-extension-v3 ", Install dependencies,than run 'pnpm dev'. image

Logs

No response

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 701.40 MB / 15.70 GB
  Binaries:
    Node: 16.14.2 - D:\nodejs\node.EXE
    npm: 8.5.0 - D:\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1702.0), Chromium (113.0.1774.42)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @crxjs/vite-plugin: npm:@crxjs/vite-plugin@beta => 2.0.0-beta.17
    vite: ^4.2.1 => 4.2.1

Severity

annoyance

heldaccountabl commented 1 year ago

@zf1998 I know nothing about vue but i'm pretty sure that the public dir is for static files just like in React, In that case you can use the assets folder given inside of the src folder and that hopefully solves your problem.

heldaccountabl commented 1 year ago

You can use the assets folder by replacing any images or icons like <link rel="icon" href="<%= BASE_URL %>favicon.ico"> to <link rel="icon" href="~/src/assets/favicon.ico">