Skip to content

Commit 697a326

Browse files
committedMar 25, 2025
Add extensions to entries in nuxt plugin (resolves #980)
1 parent 168a4ac commit 697a326

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed
 

‎packages/knip/fixtures/plugins/nuxt/app.tsx

Whitespace-only changes.

‎packages/knip/src/plugins/nuxt/index.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ const isEnabled: IsPluginEnabled = ({ dependencies }) => {
2020
const entry = ['nuxt.config.{js,mjs,ts}'];
2121

2222
const production = [
23-
'app.vue',
24-
'error.vue',
25-
'pages/**/*.vue',
26-
'layouts/default.vue',
23+
'app.{vue,jsx,tsx}',
24+
'error.{vue,jsx,tsx}',
25+
'pages/**/*.{vue,jsx,tsx}',
26+
'layouts/default.{vue,jsx,tsx}',
2727
'middleware/**/*.ts',
2828
'server/api/**/*.ts',
2929
'server/routes/**/*.ts',
@@ -35,10 +35,10 @@ const resolveEntryPaths: ResolveEntryPaths<NuxtConfig> = async localConfig => {
3535
const srcDir = localConfig.srcDir ?? '.';
3636

3737
const patterns = [
38-
'app.vue',
39-
'error.vue',
40-
join(typeof localConfig.dir?.pages === 'string' ? localConfig.dir.pages : 'pages', '**/*.vue'),
41-
join(typeof localConfig.dir?.layouts === 'string' ? localConfig.dir.layouts : 'layouts', '**/*.vue'),
38+
'app.{vue,jsx,tsx}',
39+
'error.{vue,jsx,tsx}',
40+
join(typeof localConfig.dir?.pages === 'string' ? localConfig.dir.pages : 'pages', '**/*.{vue,jsx,tsx}'),
41+
join(typeof localConfig.dir?.layouts === 'string' ? localConfig.dir.layouts : 'layouts', '**/*.{vue,jsx,tsx}'),
4242
join(typeof localConfig.dir?.middleware === 'string' ? localConfig.dir.middleware : 'middleware', '**/*.ts'),
4343
'server/api/**/*.ts',
4444
'server/routes/**/*.ts',

‎packages/knip/test/plugins/nuxt.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test('Find dependencies with the nuxt plugin', async () => {
2020
...baseCounters,
2121
dependencies: 1,
2222
exports: 1,
23-
processed: 3,
24-
total: 3,
23+
processed: 4,
24+
total: 4,
2525
});
2626
});

0 commit comments

Comments
 (0)
Please sign in to comment.