fix: error when plugin not specify js extension (#3692)

This commit is contained in:
Clark Du 2018-08-11 19:18:31 +01:00 committed by GitHub
parent aa09a20ce8
commit 3a825dc773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -446,8 +446,9 @@ export default class Builder {
// Check plugins exist then set alias to their real path // Check plugins exist then set alias to their real path
await Promise.all(this.plugins.map(async (p) => { await Promise.all(this.plugins.map(async (p) => {
if (!await fsExtra.pathExists(p.src)) { const pluginFile = `${p.src}${path.extname(p.src) ? '' : '.js'}`
throw new Error(`Plugin not found: ${p.src}`) if (!await fsExtra.pathExists(pluginFile)) {
throw new Error(`Plugin not found: ${pluginFile}`)
} }
const src = this.relativeToBuild(p.src) const src = this.relativeToBuild(p.src)

View File

@ -26,7 +26,7 @@ export default {
loadingIndicator: 'circle', loadingIndicator: 'circle',
extensions: 'ts', extensions: 'ts',
plugins: [ plugins: [
'~/plugins/test.js', '~/plugins/test',
{ src: '~/plugins/only-client.js', ssr: false } { src: '~/plugins/only-client.js', ssr: false }
], ],
loading: '~/components/loading', loading: '~/components/loading',