\n\u003C!-- OR -->\n\u003CIcon name=\"my-icon:a\" v-if=\"flag\" />\n\u003CIcon name=\"my-icon:b\" v-else />\n```\nin `nuxt.config.ts`\n```ts\nicon: {\n provider: 'server',\n customCollections: [\n {\n prefix: 'my-icon',\n dir: './assets/icon/svg',\n },\n ],\n},\n// ...\nnitro: {\n preset: 'static',\n},\n```\n\nIf toggle value of `flag`, \neverything works well in development, \nbut it throws 404 error for `my-icon:b` after building and generating.\n(it works well with `v-show`) \n\nProject info:\n```\n------------------------------\n- Operating System: Windows_NT\n- Node Version: v22.8.0\n- Nuxt Version: 3.16.0\n- CLI Version: 3.23.0\n- Nitro Version: 2.11.6\n- Package Manager: pnpm@9.9.0\n- Builder: -\n- User Config: modules, icon, colorMode, shadcn, fonts, googleSignIn, app, imports, css, vite, nitro, compatibilityDate, telemetry\n- Runtime Modules: @nuxtjs/tailwindcss@6.13.2, @nuxt/icon@1.11.0, @nuxt/fonts@0.11.0, @nuxt/image@1.9.0, @nuxt/eslint@1.2.0, @pinia/nuxt@0.10.1, pinia-plugin-persistedstate/nuxt@4.2.0, @nuxt/test-utils/module@3.17.2, @nuxtjs/color-mode@3.5.2, shadcn-nuxt@1.0.3, @vueuse/nuxt@13.0.0, nuxt-vue3-google-signin@0.0.11\n- Build Modules: -\n------------------------------\n```\n",[],380,"nuxt","icon","open","Local icon 404 after `nuxi generating` if with `:name=\"flag?'my-icon:icon-a':'my-icon:icon-b'\"`","2025-03-26T15:31:52Z","https://github.com/nuxt/icon/issues/380",0.6345816,{"description":3146,"labels":3147,"number":3151,"owner":3138,"repository":3152,"state":3140,"title":3153,"updated_at":3154,"url":3155,"score":3156},"### Environment\n\n```\nNuxt project info: (copied to clipboard) nuxi 2:52:12 PM\n\n------------------------------\n- Operating System: Linux\n- Node Version: v22.13.1\n- Nuxt Version: 4.0.3\n- CLI Version: 3.27.0\n- Nitro Version: 2.12.4\n- Package Manager: npm@11.3.0\n- Builder: -\n- User Config: app, compatibilityDate, devtools, modules, devServer, imports, runtimeConfig, vite, routeRules\n- Runtime Modules: @nuxt/eslint@1.5.2, @nuxt/test-utils/module@3.19.2\n- Build Modules: -\n------------------------------\n\n👉 Report an issue: https://github.com/nuxt/nuxt/issues/new?template=bug-report.yml\n👉 Suggest an improvement: https://github.com/nuxt/nuxt/discussions/new\n👉 Read documentation: https://nuxt.com\n```\n\n### Reproduction\n\nhttps://stackblitz.com/edit/github-lzbjpwsv\n\n\n### Describe the bug\n\n`mockNuxtImport` doesn't seem to work with composables in a nested directory when following the documentation's recommendation to re-export nested composables (https://nuxt.com/docs/4.x/guide/directory-structure/app/composables#how-files-are-scanned).\n\n- In the reproduction code, there are two composables in `composables/nested/`: `useParent` and `useChild`.\n- `useParent` calls `useChild`.\n- These composables are re-exported by `composables/index.ts`, as recommended by the aforementioned documentation.\n- The test suite for `useParent` (`composables/nested/useParent.nuxt.spec.ts`) mocks `useChild` using `mockNuxtImport`; however, `useParent` calls the original `useChild` instead of the mock.\n\nIt's possible that this is a duplicate of https://github.com/nuxt/test-utils/issues/708. Apologies if so.\n\nSwitching to nested directory scanning via Nuxt config (`nuxt.config.ts -> imports-> dirs`) fixes the issue, but goes against the recommendations in the docs.\n\n### Additional context\n\nNote that the repro. uses Nuxt 3, but the issue is still present in Nuxt 4.\n\n### Logs\n\n```shell-script\n❯ npm run test\n\n> test\n> vitest\n\n(node:357) ExperimentalWarning: WASI is an experimental feature and might change at any time\n(Use `node --trace-warnings ...` to show where the warning was created)\n\n DEV v3.2.4 /home/projects/mklilmrmvl.github\n\nstdout | composables/nested/useParent.nuxt.spec.ts > checks that the child is called\nuseParent called. Calling useChild().\nuseChild called.\n\n ❯ nuxt composables/nested/useParent.nuxt.spec.ts (1 test | 1 failed) 8ms\n × checks that the child is called 7ms\n → expected +0 to be 1 // Object.is equality\n\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\n\n FAIL nuxt composables/nested/useParent.nuxt.spec.ts > checks that the child is called\nAssertionError: expected +0 to be 1 // Object.is equality\n\n- Expected\n+ Received\n\n- 1\n+ 0\n\n ❯ eval composables/nested/useParent.nuxt.spec.ts:13:3\n 11| useParent();\n 12| \n 13| expect(mockUseChild.mock.calls.length).toBe(1);\n | ^\n 14| });\n 15| \n ❯ ../../../blitz.96435430.js:31:27890\n ❯ new Promise ../../../blitz.96435430.js:31:27849\n\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯\n\n\n Test Files 1 failed (1)\n Tests 1 failed (1)\n Start at 15:05:16\n Duration 3.74s (transform 475ms, setup 449ms, collect 419ms, tests 8ms, environment 804ms, prepare 645ms)\n\n FAIL Tests failed. Watching for file changes...\n press h to show help, press q to quit\n\n\nThe test outputs \"useChild called.\" That shouldn't happen. Instead, the mock should be called.\n```",[3148],{"name":3149,"color":3150},"pending triage","5D08F5",1395,"test-utils","mockNuxtImport doesn't work for nested composables","2025-08-26T22:06:55Z","https://github.com/nuxt/test-utils/issues/1395",0.6563985,{"description":3158,"labels":3159,"number":3165,"owner":3138,"repository":3138,"state":3166,"title":3167,"updated_at":3168,"url":3169,"score":3170},"### Environment\r\n\r\nENV\r\nos: Darwin\r\nnodejs: 20.9.0\r\nnuxt: 3.8.1\r\n@nuxt/test-utils: 3.8.1\r\nvitest: 1.1.1\r\nyarn: 1.15.2\r\n\r\n### Reproduction\r\n\r\nhttps://stackblitz.com/edit/nuxt-starter-rx4vx2?file=package.json,testUtils.js,testUtils.test.js\r\n\r\nyou can run test command below.\r\n```\r\nnpm test\r\n``` \r\n\r\n### Describe the bug\r\n\r\nHello, I am using Vitest for testing on Nuxt3, vite env.\r\nDue to our team's convention, the configuration uses 'autoImport: false'.(For an explicit declaration) So when importing Nuxt's built-in items (useRoute, nextTick, computed, etc.) we use import '#imports'.\r\n\r\nWhen I run Vitest, the following error occurs:\r\n\r\nError: Failed to resolve import \"#imports\" from \"[file path]\". Does the file exist?\r\nHow do I solve this? help.\r\nIs this something that needs to be fixed in vitest?\r\n(I registered an issue on vitest. https://github.com/vitest-dev/vitest/issues/4853)\r\n(https://github.com/nuxt/nuxt/discussions/24719)\r\n\r\nBelow is my vitest.config.js\r\n```javascript\r\nimport path from 'path';\r\nimport vue from '@vitejs/plugin-vue';\r\n\r\nexport default {\r\n plugins: [vue()],\r\n test: {\r\n globals: true,\r\n environment: 'jsdom'\r\n },\r\n resolve: {\r\n alias: {\r\n '@': path.resolve(__dirname, './src')\r\n }\r\n }\r\n};\r\n``` \r\n\r\nThanks.\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[3160,3163],{"name":3161,"color":3162},"3.x","29bc7f",{"name":3149,"color":3164},"E99695",25021,"closed","Vitest can't resolve import '#imports'(Nuxt3, vitest)","2024-06-21T04:50:44Z","https://github.com/nuxt/nuxt/issues/25021",0.6249177,{"description":3172,"labels":3173,"number":3174,"owner":3138,"repository":3152,"state":3166,"title":3175,"updated_at":3176,"url":3177,"score":3144},"Example in https://test-utils.nuxtjs.org/api-reference/app-testing not working. \r\nAfter run test get error:\r\n\r\n```\r\n/firsttest.spec.js:1\r\n({\"Object.\u003Canonymous>\":function(module,exports,require,__dirname,__filename,global,jest){import { get, setupTest } from '@nuxt/test-utils';\r\n\r\nSyntaxError: Cannot use import statement outside a module\r\n```\r\nmy setup:\r\n\r\nin jest.config.js\r\n```\r\nmodule.exports = {\r\n clearMocks: true,\r\n testMatch: [\r\n '*/__tests__/**/*.[jt]s?(x)',\r\n '**/?(*.)+(spec|test).[tj]s?(x)',\r\n '**/test/(*.)+(spec|test).js'],\r\n moduleNameMapper: {\r\n '^@/(.*)$': '\u003CrootDir>/$1',\r\n '^~/(.*)$': '\u003CrootDir>/$1',\r\n },\r\n moduleFileExtensions: ['js', 'vue', 'json'],\r\n testEnvironment: 'jsdom',\r\n transform: {\r\n '^.+\\\\.js$': 'babel-jest',\r\n '.*\\\\.(vue)$': 'vue-jest',\r\n },\r\n preset: '@nuxt/test-utils',\r\n}\r\n```\r\nin package.json\r\n```\r\n{\r\n \"name\": \"\",\r\n \"version\": \"1.0.0\",\r\n \"main\": \"index.js\",\r\n \"scripts\": {\r\n \"test\": \"node_modules/.bin/jest\"\r\n },\r\n \"author\": \"\",\r\n \"license\": \"\",\r\n \"dependencies\": {\r\n \"bootstrap\": \"^4.5.3\",\r\n \"bootstrap-vue\": \"^2.20.1\",\r\n \"nuxt\": \"^2.15.2\",\r\n\r\n },\r\n \"devDependencies\": {\r\n \"@babel/plugin-transform-modules-commonjs\": \"^7.12.1\",\r\n \"@nuxt/test-utils\": \"^0.2.0\",\r\n \"@vue/test-utils\": \"^1.1.1\",\r\n \"babel-jest\": \"^26.6.3\",\r\n \"jest\": \"^26.6.3\",\r\n \"vue-jest\": \"^3.0.7\"\r\n }\r\n}\r\n\r\n```\r\n\r\n\r\n",[],267,"Example in https://test-utils.nuxtjs.org/api-reference/app-testing not working","2023-12-02T00:28:12Z","https://github.com/nuxt/test-utils/issues/267",{"description":3172,"labels":3179,"number":3137,"owner":3138,"repository":3152,"state":3166,"title":3175,"updated_at":3180,"url":3181,"score":3144},[],"2023-12-02T00:13:09Z","https://github.com/nuxt/test-utils/issues/380",{"description":3172,"labels":3183,"number":3184,"owner":3138,"repository":3152,"state":3166,"title":3175,"updated_at":3185,"url":3186,"score":3144},[],481,"2023-12-02T00:13:13Z","https://github.com/nuxt/test-utils/issues/481",{"description":3188,"labels":3189,"number":3190,"owner":3138,"repository":3152,"state":3166,"title":3191,"updated_at":3180,"url":3192,"score":3193},"### Environment\r\n\r\n- Operating System: `Linux`\r\n- Node Version: `v16.14.2`\r\n- Nuxt Version: `3.0.0-rc.8`\r\n- Package Manager: `npm@7.17.0`\r\n- Builder: `vite`\r\n- User Config: `modules`\r\n- Runtime Modules: `vite-plugin-vue-type-imports/nuxt`\r\n- Build Modules: `-`\r\n\r\n### Reproduction\r\n\r\n#### How to recreate\r\n\r\nFor every link:\r\n\r\n1. Open a link.\r\n2. Wait for a development server is start and the Nuxt Welcome page is loaded.\r\n4. Press \u003Ckbd>Ctrl\u003C/kbd> + \u003Ckbd>C\u003C/kbd> in Terminal.\r\n5. Run `npm test`.\r\n\r\n#### Broken\r\n\r\nhttps://stackblitz.com/edit/github-owtwqh-82agcd?file=nuxt.config.ts,modules%2Fvite-plugin-vue-type-imports.ts,app.vue\r\n\r\n##### Load a bundled Nuxt module from the `node_modules` directory\r\n\r\n```ts\r\nexport default defineNuxtConfig({\r\n modules: [\r\n 'vite-plugin-vue-type-imports/nuxt',\r\n ],\r\n});\r\n```\r\n\r\n#### Working\r\n\r\nhttps://stackblitz.com/edit/github-owtwqh-dyj8f8?file=nuxt.config.ts,modules%2Fvite-plugin-vue-type-imports.ts,app.vue\r\n\r\n##### Load a local Nuxt module from the `modules/` directory\r\n\r\n```ts\r\nexport default defineNuxtConfig({\r\n modules: [\r\n '~/modules/vite-plugin-vue-type-imports.ts',\r\n ],\r\n});\r\n```\r\n\r\n### Describe the bug\r\n\r\nThe `vite-plugin-vue-type-imports/nuxt` module added in `nuxt.config.ts` is:\r\n\r\n* works when loaded via `npm run dev`;\r\n* broken if loaded via `npm test` (`nuxt test` or `vitest` with `@nuxt/test-utils-edge`).\r\n\r\n### Additional context\r\n\r\nThe [same Nuxt module code](https://github.com/wheatjs/vite-plugin-vue-type-imports/blob/370fcea9c7a09a0961bdf6e29b0795963034eb1e/src/nuxt.ts) is works with `npm test` if copy-pasted and loaded as a local plugin from the `modules/` directory.\r\n\r\n### Logs\r\n\r\n```shell\r\nERROR TypeError: Invalid URL 22:18:50\r\n\r\n ❯ TypeError.get https:/github-owtwqh-82agcd.w.staticblitz.com/blitz.df64f655701fde45529fa8e152b3842072335b47.js:6:292488\r\n 22:18:50\r\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\r\nSerialized Error: { 22:18:50\r\n \"code\": \"ERR_INVALID_URL\",\r\n \"input\": \"//\",\r\n}\r\n```\r\n",[],429,"Vitest with `@nuxt/test-utils-edge` breaks imported `vite-plugin-vue-type-imports/nuxt` module, but works if same module code is recreated locally","https://github.com/nuxt/test-utils/issues/429",0.6392003,{"description":3195,"labels":3196,"number":3198,"owner":3138,"repository":3152,"state":3166,"title":3199,"updated_at":3200,"url":3201,"score":3202},"### Environment\n\n------------------------------\r\n- Operating System: Linux\r\n- Node Version: v18.18.0\r\n- Nuxt Version: 3.9.0\r\n- CLI Version: 3.10.0\r\n- Nitro Version: 2.8.1\r\n- Package Manager: pnpm@8.10.5\r\n- Builder: -\r\n- User Config: modules, devtools, runtimeConfig\r\n- Runtime Modules: @nuxt/test-utils/module@3.9.0, ()\r\n- Build Modules: -\r\n------------------------------\n\n### Reproduction\n\nWith the latest nuxt test-utils I was trying to mock a server side import. Before even able to mock the server side import, I have realized that the plain vanilla minimal nuxt module seems to be ignored/not executed when running e2e test. \r\n\r\nSee repro here:\r\nhttps://stackblitz.com/edit/nuxt-vitest-x6ycht\r\n\n\n### Describe the bug\n\nBasic setup is to have a server side import coming from a module. an API is using that import to return a value. Running `pnpm dev` works, and the API returns the value as expected.\r\n\r\nRunning an E2E test in the nuxt environment however fails, showing error messages which are hinting that the module import has not been executed:\r\n\r\n`(node-resolve plugin) Could not resolve import \"#auth\" in /home/projects/nuxt-vitest-x6ycht/server/api/test.get.ts using imports defined in /home/projects/nuxt-vitest-x6ycht/package.json.`\r\n\r\nMaybe my test config needs to be improved? Or is it a bug?\n\n### Additional context\n\n_No response_\n\n### Logs\n\n_No response_",[3197],{"name":3149,"color":3150},677,"Nuxt module import in E2E environment","2023-12-26T20:05:15Z","https://github.com/nuxt/test-utils/issues/677",0.64581275,{"description":3188,"labels":3204,"number":3208,"owner":3138,"repository":3152,"state":3166,"title":3191,"updated_at":3209,"url":3210,"score":3211},[3205],{"name":3206,"color":3207},"bug","d73a4a",345,"2023-12-02T00:33:10Z","https://github.com/nuxt/test-utils/issues/345",0.6459313,{"description":3213,"labels":3214,"number":3222,"owner":3138,"repository":3152,"state":3166,"title":3223,"updated_at":3224,"url":3225,"score":3226},"### Environment\n\n- Node Version: v20.18.1\n- Nuxt Version: 3.8.2\n- CLI Version: 3.10.0\n- Nitro Version: 2.8.1\n- Package Manager: yarn@1.22.22\n- Builder: -\n- User Config: ssr, experimental, runtimeConfig, modules, site, ui, colorMode, pwa, tailwindcss, i18n, viewport, imports, devtools, typescript, alias, routeRules, $production\n- Runtime Modules: @nuxtjs/google-fonts@3.1.3, @nuxt/image@1.0.0-rc.3, nuxt-schema-org@3.2.3, nuxt-icon@0.4.2, @nuxtjs/i18n@8.0.0-rc.11, nuxt-viewport@2.0.6, @nuxtjs/device@3.1.1, @nuxt/ui@2.11.1, @vueuse/nuxt@10.7.0, @vite-pwa/nuxt@0.3.5, @artmizu/nuxt-prometheus@2.4.0\n\n### Reproduction\n\n1. exec yarn add --dev @nuxt/test-utils@3.9.0\n2. yarn build\n\n### Describe the bug\n\ncheck yarn.lock, it generate this info:\nvitest-environment-nuxt@^1.0.0, vitest-environment-nuxt@^1.0.1:\n version \"1.0.1\"\n resolved \"https://registry.npmmirror.com/vitest-environment-nuxt/-/vitest-environment-nuxt-1.0.1.tgz#e3308454af1947dbc315ce2a805a9d4fe4d1c49a\"\n integrity sha512-eBCwtIQriXW5/M49FjqNKfnlJYlG2LWMSNFsRVKomc8CaMqmhQPBS5LZ9DlgYL9T8xIVsiA6RZn2lk7vxov3Ow==\n dependencies:\n \"@nuxt/test-utils\" \">=3.13.1\"\n\nI think this version default vitest-environment-nuxt@^1.0.0, and not auto import 1.0.1, it will occur compatible problem in low version\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell-script\n\n```",[3215,3218,3219],{"name":3216,"color":3217},"needs reproduction","DE7793",{"name":3149,"color":3150},{"name":3220,"color":3221},"closed-by-bot","ededed",1260,"About test-utils import vitest-environment-nuxt@^1.0.1 occur compatible problem","2025-05-05T02:14:50Z","https://github.com/nuxt/test-utils/issues/1260",0.6490831,["Reactive",3228],{},["Set"],["ShallowReactive",3231],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fbzTmmGFQ8wyekEgbECqGiDx0hrsHXtxP4iwtxbPqlfw":-1},"/nuxt/test-utils/508"]