diff --git a/lib/builder/builder.js b/lib/builder/builder.js index 92293c05f8..62970aa943 100644 --- a/lib/builder/builder.js +++ b/lib/builder/builder.js @@ -446,8 +446,9 @@ export default class Builder { // Check plugins exist then set alias to their real path await Promise.all(this.plugins.map(async (p) => { - if (!await fsExtra.pathExists(p.src)) { - throw new Error(`Plugin not found: ${p.src}`) + const pluginFile = `${p.src}${path.extname(p.src) ? '' : '.js'}` + if (!await fsExtra.pathExists(pluginFile)) { + throw new Error(`Plugin not found: ${pluginFile}`) } const src = this.relativeToBuild(p.src) diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 5fb322ca3f..1805f4410a 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -26,7 +26,7 @@ export default { loadingIndicator: 'circle', extensions: 'ts', plugins: [ - '~/plugins/test.js', + '~/plugins/test', { src: '~/plugins/only-client.js', ssr: false } ], loading: '~/components/loading',