-
-
Notifications
You must be signed in to change notification settings - Fork 468
Closed
Labels
pending-triageSomeone (usually a maintainer) needs to look into this to see if it's a bugSomeone (usually a maintainer) needs to look into this to see if it's a bug
Description
Describe the bug
After upgrading from 0.20.14 to 0.20.15, the build process fails with a TypeError: Cannot read properties of undefined (reading '0').
The error originates from WXT's internal Vite builder within the assetFileNames hook. It appears the logic introduced in the latest version assumes assetInfo.name is always a string. However, when CSS is imported using the ?inline query (a common pattern for Shadow DOM injection), Vite/Rollup can emit assets where the name is undefined, causing the internal WXT hook to crash.
Reproduction
A minimal setup importing CSS as a string triggers the failure:
src/entrypoints/example.content.ts
import styles from './styles.css?inline';
export default defineContentScript({
matches: ['*://*/*'],
main(ctx) {
console.log("Inlined CSS:", styles);
},
});src/entrypoints/styles.css
.test { color: blue; }Steps to reproduce
- Use wxt@0.20.15.
- Import a CSS file with the ?inline suffix in a content script.
- Run wxt build or wxt dev.
- The build fails with the following stack trace:
ERROR [vite:css-post] Cannot read properties of undefined (reading '0')
at assetFileNames (/node_modules/wxt/dist/core/builders/vite/index.mjs:82:56)
at getCssAssetDirname (/node_modules/vite/dist/node/chunks/dep-C6uTJdX2.js:36210:9)
at resolveAssetUrlsInCss (/node_modules/vite/dist/node/chunks/dep-C6uTJdX2.js:36329:73)
System Info
System:
OS: macOS 26.2
CPU: (10) arm64 Apple M1 Pro
Memory: 306.31 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.18.0
npm: 10.9.3
pnpm: 8.15.7
Browsers:
Brave Browser: 142.1.84.132
Chrome: 144.0.7559.133
Firefox: 95.0.2
Safari: 26.2
npmPackages:
vite: ^4.4.9 => 4.4.9Used Package Manager
pnpm
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
pending-triageSomeone (usually a maintainer) needs to look into this to see if it's a bugSomeone (usually a maintainer) needs to look into this to see if it's a bug