mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
improve plugin imports
This commit is contained in:
parent
652c3d63d1
commit
67f04458ec
@ -12,9 +12,8 @@ import { setContext, getLocation, getRouteData } from './utils'
|
||||
<% if (store) { %>import { createStore } from './store.js'<% } %>
|
||||
|
||||
/* Plugins */
|
||||
|
||||
<% plugins.forEach(plugin => { %>// <%= plugin.src %><%= (plugin.ssr===false) ? ' (Only included in client bundle)' : '' %>
|
||||
import <%= plugin.name %> from '<%= plugin.name %>'<% }) %>
|
||||
<% plugins.forEach(plugin => { %>import <%= plugin.name %> from '<%= plugin.name %>' // Source: <%= relativeToBuild(plugin.src) %><%= (plugin.ssr===false) ? ' (ssr: false)' : '' %>
|
||||
<% }) %>
|
||||
|
||||
// Component: <no-ssr>
|
||||
Vue.component(NoSSR.name, NoSSR)
|
||||
|
@ -69,14 +69,14 @@ export default class Builder {
|
||||
}
|
||||
|
||||
get plugins() {
|
||||
return this.options.plugins.map((p, i) => {
|
||||
return _.uniqBy(this.options.plugins.map((p, i) => {
|
||||
if (typeof p === 'string') p = { src: p }
|
||||
return {
|
||||
src: this.nuxt.resolvePath(p.src),
|
||||
ssr: (p.ssr !== false),
|
||||
name: basename(p.src, extname(p.src)).replace(/[^a-zA-Z?\d\s:]/g, '') + '_plugin_' + hash(p.src)
|
||||
name: basename(p.src, extname(p.src)).replace(/[^a-zA-Z?\d\s:]/g, '') + '_' + hash(p.src)
|
||||
}
|
||||
})
|
||||
}), p => p.name)
|
||||
}
|
||||
|
||||
vendor() {
|
||||
|
Loading…
Reference in New Issue
Block a user