Vue.js Async Components
See original GitHub issue- Laravel Mix Version: 1.4.5
- Node Version (
node -v
): 8.5.0 - NPM Version (
npm -v
): 5.4.2 - OS: macOS High Sierra
Description:
Does anyone know how to get Vue.js async components to work? Getting the following error:
Syntax Error: Unexpected token (10:25)
8 | el: '#app',
9 | components: {
> 10 | 'example': () => import('./components/Example')
| ^
11 | }
12 | });```
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:33 (12 by maintainers)
Top Results From Across the Web
Async Components - Vue.js
The resulting AsyncComp is a wrapper component that only calls the loader function when it is actually rendered on the page. In addition,...
Read more >Async Components in Vue 3 - This Dot Labs
Async components are best used in medium to large apps. When an app is formed out of several hundred components, it's wise not...
Read more >Async Vue.js Components - Vue School Blog
While async components can improve an app loading time by splitting and deferring the loading of their chunks, they could have an impact...
Read more >How async components can optimize performance in Vue apps
Using async components to build large scale apps is key to maintaining optimal performance. Async components not only ensure your retention rate ...
Read more >Vue 3 UX Wins with Async Components & Suspense
Lazy loading with Vue 3 async component API ... Vue 3 has introduced the defineAsyncComponent API which makes it very simple to lazy...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ruchern It is specific to webpack (tooling), after all it is babel who will transform the code and will pass to uglify-js. So it is upto end user to configure and enable modern feature.
@pix2D
Here is the complete tutorial -
⚠️ Updated for Laravel Mix v3+
.babelrc
in your project root, and specify the pluginPS If you want to load components via computed property, read this