-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
61 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { wrapFunctional } from './utils' | ||
|
||
<%= options.getComponents().map(c => { | ||
const exp = c.pascalName === c.export ? c.pascalName : `${c.export} as ${c.pascalName}` | ||
return `export { ${exp} } from '../${relativeToBuild(c.filePath)}'` | ||
}).join('\n') %> | ||
|
||
<%= options.getComponents().map(c => { | ||
const exp = c.export === 'default' ? `c.default || c` : `c['${c.export}']` | ||
const magicComments = [ | ||
`webpackChunkName: "${c.chunkName}"`, | ||
c.prefetch === true || typeof c.prefetch === 'number' ? `webpackPrefetch: ${c.prefetch}` : false, | ||
c.preload === true || typeof c.preload === 'number' ? `webpackPreload: ${c.preload}` : false, | ||
].filter(Boolean).join(', ') | ||
|
||
return `export const Lazy${c.pascalName} = import('../${relativeToBuild(c.filePath)}' /* ${magicComments} */).then(c => wrapFunctional(${exp}))` | ||
if (c.isAsync) { | ||
const exp = c.export === 'default' ? `c.default || c` : `c['${c.export}']` | ||
const asyncImport = `import('../${relativeToBuild(c.filePath)}' /* ${magicComments} */).then(c => wrapFunctional(${exp}))` | ||
return `export const ${c.pascalName} = ${asyncImport}` | ||
} else { | ||
const exp = c.export === 'default' ? `default as ${c.pascalName}` : c.pascalName | ||
return `export { ${exp} } from '../${relativeToBuild(c.filePath)}'` | ||
} | ||
}).join('\n') %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
import Vue from 'vue' | ||
import { wrapFunctional } from './utils' | ||
|
||
<% const components = options.getComponents() %> | ||
|
||
const components = { | ||
<%= components.map(c => { | ||
const exp = c.export === 'default' ? `c.default || c` : `c['${c.export}']` | ||
const magicComments = [ | ||
`webpackChunkName: "${c.chunkName}"`, | ||
c.prefetch === true || typeof c.prefetch === 'number' ? `webpackPrefetch: ${c.prefetch}` : false, | ||
c.preload === true || typeof c.preload === 'number' ? `webpackPreload: ${c.preload}` : false, | ||
].filter(Boolean).join(', ') | ||
|
||
return ` ${c.pascalName.replace(/^Lazy/, '')}: () => import('../${relativeToBuild(c.filePath)}' /* ${magicComments} */).then(c => wrapFunctional(${exp}))` | ||
}).join(',\n') %> | ||
} | ||
import * as components from './index' | ||
|
||
for (const name in components) { | ||
Vue.component(name, components[name]) | ||
Vue.component('Lazy' + name, components[name]) | ||
Vue.component('Lazy' + name, () => Promise.resolve(components[name])) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters