wxt-dev / wxt-dev/wxt

[@vitejs/plugin-vue] Content Script UI can't reload

Open
#538 12 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

vite plugin
Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

A clear and concise description of what the bug is.

To Reproduce
  1. git clone git@github.com:tjx666/open-related-websites.git
  2. git reset --hard ef81483a71bf2345def48aa2df423b3df1119b94
  3. pnpm dev
  4. issue1: open entrypoints/content/Search.vue and change the content, page will reload but content script doesn't updated
  5. issue2: If you try to add some code in entrypoints/content/Search.vue for example console.log(123), will cause crash and wxt dev process exit
Expected behavior
  1. content script UI can be reload.
  2. modify entrypoints/content/Search.vue should not cause wxt exit.
Screenshots
console output
ℹ Changed: entrypoints/content/Search.vue                                                                                    10:29:45 AM
entrypoints/content/Search.vue (1:7) Error when using sourcemap for reporting an error: Can't resolve original location of error.
x Build failed in 166ms

[10:29:45 AM]  ERROR  "default" is not exported by "entrypoints/content/Search.vue?vue&type=script&setup=true&lang.ts", imported by "entrypoints/content/Search.vue".
file: /Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue:1:7
1: import _sfc_main from "/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue?vue&type=script&set...
          ^
2: export * from "/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue?vue&type=script&setup=true&...
3: import _export_sfc from "\0plugin-vue:export-helper";

  file: entrypoints/content/Search.vue:1:7
  1: import _sfc_main from "entrypoints/content/Search.vue?vue&type=script&set...
  ^
  2: export * from "entrypoints/content/Search.vue?vue&type=script&setup=true&...
  3: import _export_sfc from "\0plugin-vue:export-helper";
  at getRollupError (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/parseAst.js:375:41)
  at error (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/parseAst.js:372:42)
  at Module.error (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:13651:16)
  at Module.traceVariable (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:14099:29)
  at ModuleScope.findVariable (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:11802:39)
  at Identifier.bind (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:7296:40)
  at CallExpression.bind (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:4728:28)
  at CallExpression.bind (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:8961:15)
  at ExportDefaultDeclaration.bind (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:4732:23)
  at Program.bind (node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:4728:28)

file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/wxt@0.17.7/node_modules/wxt/dist/cli.js:283
      throw Error(`Failed to build ${groupNames.join(", ")}`, { cause: err });
            ^

Error: Failed to build content
    at buildEntrypoints (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/wxt@0.17.7/node_modules/wxt/dist/cli.js:283:13)
    at async rebuild (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/wxt@0.17.7/node_modules/wxt/dist/cli.js:3053:21)
    at async file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/wxt@0.17.7/node_modules/wxt/dist/cli.js:3532:37 {
  [cause]: Error [RollupError]: "default" is not exported by "entrypoints/content/Search.vue?vue&type=script&setup=true&lang.ts", imported by "entrypoints/content/Search.vue".
  file: /Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue:1:7
  1: import _sfc_main from "/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue?vue&type=script&set...
            ^
  2: export * from "/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue?vue&type=script&setup=true&...
  3: import _export_sfc from "\0plugin-vue:export-helper";
      at getRollupError (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/parseAst.js:375:41)
      at error (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/parseAst.js:372:42)
      at Module.error (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:13651:16)
      at Module.traceVariable (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:14099:29)
      at ModuleScope.findVariable (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:11802:39)
      at Identifier.bind (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:7296:40)
      at CallExpression.bind (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:4728:28)
      at CallExpression.bind (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:8961:15)
      at ExportDefaultDeclaration.bind (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:4732:23)
      at Program.bind (file:///Users/yutengjing/code/open-related-website/node_modules/.pnpm/rollup@4.12.1/node_modules/rollup/dist/es/shared/node-entry.js:4728:28) {
    binding: 'default',
    code: 'MISSING_EXPORT',
    exporter: '/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue?vue&type=script&setup=true&lang.ts',
    id: '/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue',
    url: 'https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module',
    pos: 7,
    loc: {
      column: 7,
      file: '/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue',
      line: 1
    },
    frame: '1: import _sfc_main from "/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue?vue&type=script&set...\n' +
      '          ^\n' +
      '2: export * from "/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue?vue&type=script&setup=true&...\n' +
      '3: import _export_sfc from "\\0plugin-vue:export-helper";',
    watchFiles: [
      'package.json',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/wxt@0.17.7/node_modules/wxt/dist/client.js',
      '/Users/yutengjing/code/open-related-website/entrypoints/content/index.ts',
      '/Users/yutengjing/code/open-related-website/package.json',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/wxt@0.17.7/node_modules/wxt/dist/sandbox.js',
      '/Users/yutengjing/code/open-related-website/entrypoints/content/Search.vue',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/vue@3.4.21_typescript@5.4.2/node_modules/vue/dist/vue.runtime.esm-bundler.js',
      '/Users/yutengjing/code/open-related-website/assets/main.css',
      '/Users/yutengjing/code/open-related-website/entrypoints/background.ts',
      '/Users/yutengjing/code/open-related-website/entrypoints/popup/main.ts',
      '/Users/yutengjing/code/open-related-website/entrypoints/content/adapters/BaseAdapter.ts',
      '/Users/yutengjing/code/open-related-website/entrypoints/content/adapters/WebIdeAdapter.ts',
      '/Users/yutengjing/code/open-related-website/entrypoints/content/adapters/index.ts',
      '/Users/yutengjing/code/open-related-website/entrypoints/popup/App.vue',
      '/Users/yutengjing/code/open-related-website/entrypoints/popup/index.html',
      '/Users/yutengjing/code/open-related-website/components/HelloWorld.vue',
      '/Users/yutengjing/code/open-related-website/tailwind.config.ts',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/@webext-core+match-patterns@1.0.3/node_modules/@webext-core/match-patterns/lib/index.js',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/wxt@0.17.7/node_modules/wxt/dist/chunk-FNTE2L27.js',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/@webext-core+isolated-element@1.1.1/node_modules/@webext-core/isolated-element/lib/index.js',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/@vue+runtime-dom@3.4.21/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/webextension-polyfill@0.10.0/node_modules/webextension-polyfill/dist/browser-polyfill.js',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/@vue+shared@3.4.21/node_modules/@vue/shared/dist/shared.esm-bundler.js',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/@vue+runtime-core@3.4.21/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js',
      '/Users/yutengjing/code/open-related-website/node_modules/.pnpm/@vue+reactivity@3.4.21/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js'
    ]
  }
}

Node.js v18.18.0
  ~/code/open-related-website   main wip !1                                                               ✘ 1  8.7s  18.18.0  0.0.0
❯ 
Environment
  System:
    OS: macOS 14.4
    CPU: (8) arm64 Apple M2
    Memory: 631.22 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.0 - ~/Library/Caches/fnm_multishells/23259_1710037298460/bin/node
    Yarn: 1.22.21 - ~/Library/Caches/fnm_multishells/23259_1710037298460/bin/yarn
    npm: 10.5.0 - ~/Library/Caches/fnm_multishells/23259_1710037298460/bin/npm
    pnpm: 8.15.4 - ~/Library/Caches/fnm_multishells/23259_1710037298460/bin/pnpm
    bun: 1.0.30 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 122.0.6261.112
    Edge: 122.0.2365.80
    Safari: 17.4
  npmPackages:
    wxt: ^0.17.7 => 0.17.7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with the referenced repository at commit ef81483a71bf2345def48aa2df423b3df1119b94, then run pnpm dev and edit entrypoints/content/Search.vue. Inspect the content entrypoint and the WXT/Vite build output around the reported missing default export. Done means content-script UI edits reload successfully and a simple console.log change no longer exits the dev process.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
build-system, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.