diff --git a/packages/builder/src/builder.js b/packages/builder/src/builder.js index 9196229faa..093cf14245 100644 --- a/packages/builder/src/builder.js +++ b/packages/builder/src/builder.js @@ -123,7 +123,7 @@ export default class Builder { resolvePlugins() { // Check plugins exist then set alias to their real path return Promise.all(this.plugins.map(async (p) => { - const ext = path.extname(p.src) ? '' : '{.+([^.]),/index.+([^.])}' + const ext = '{?(.+([^.])),/index.+([^.])}' const pluginFiles = await glob(`${p.src}${ext}`) if (!pluginFiles || pluginFiles.length === 0) { diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 670c6508bf..13caab9570 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -37,6 +37,7 @@ export default { extensions: 'ts', plugins: [ '~/plugins/test', + '~/plugins/test.plugin', { src: '~/plugins/only-client.js', ssr: false } ], loading: '~/components/loading', diff --git a/test/fixtures/with-config/plugins/test.plugin.js b/test/fixtures/with-config/plugins/test.plugin.js new file mode 100644 index 0000000000..9d36fa2f97 --- /dev/null +++ b/test/fixtures/with-config/plugins/test.plugin.js @@ -0,0 +1,5 @@ +if (process.client) { + window.__test_plugin_ext = true +} else { + global.__test_plugin_ext = true +} diff --git a/test/unit/with-config.test.js b/test/unit/with-config.test.js index 754ef49676..7860deab6e 100644 --- a/test/unit/with-config.test.js +++ b/test/unit/with-config.test.js @@ -90,6 +90,7 @@ describe('with-config', () => { expect(html).toContain('