crxjs / chrome-extension-tools

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

Cannot generate a new lib file using vite #645

Open chan-dev opened 1 year ago

chan-dev commented 1 year ago

Build tool

Rollup

Where do you see the problem?

Describe the bug

I have this configuration to generate a javascript file to inject using chrome.scripting.

export default defineConfig({
  plugins: [crx({ manifest })],
  build: {
    outDir: "./dist",
    lib: {
      entry: "src/override.ts",
      name: "test",
      formats: ["iife"],
    },
    rollupOptions: {
      output: {
        entryFileNames: "override.js",
        extend: true,
      },
    },
  },
});

The build shows no error, but no file is generated.

Reproduction

n/a

Logs

No error logs

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
    Memory: 3.22 GB / 7.66 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 16.19.0 - ~/.nvm/versions/node/v16.19.0/bin/node
    npm: 8.19.3 - ~/.nvm/versions/node/v16.19.0/bin/npm
  Browsers:
    Chrome: 109.0.5414.119
    Firefox: 109.0.1
  npmPackages:
    @crxjs/vite-plugin: ^2.0.0-beta.12 => 2.0.0-beta.12
    vite: ^4.0.0 => 4.0.4

Severity

annoyance

rbhalla commented 1 year ago

I believe the beta version of this library is at most supporting Vite 3. Your npm packages seem to indicate you are on vite 4. If possible, it may be worth trying to downgrade and see if that helps?

chan-dev commented 1 year ago

@rbhalla Oh, haven't noticed that one. It seems to be working fine now.

rbhalla commented 1 year ago

@chan-dev, nice, on vite 4? If so, worth closing the issue?

chan-dev commented 1 year ago

@rbhalla Sorry. I wasn't clear about it. I've downgraded to Vite 3 just to be sure. However haven't tried it again in Vite 4, so i can't say for sure.