Last active
November 5, 2021 21:51
-
-
Save anchal20/f2ac9807263e106c1308f7143df1cf09 to your computer and use it in GitHub Desktop.
What is a standalone and runtime-only build in Vue js?
This file contains hidden or 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
In this Document you will find two ways to write a vuejs app - standalone build and runtime-only build. The former includes the template compiler and later does not. The template compiler is responsible for compiling vue templates to plain javascript render function | |
1. The standalone build includes the compiler and supports the template option. It also relies on the presence of browser APIs so you cannot use it for server-side rendering. | |
2. The runtime-only build does not include the template compiler, and does not support the template option. You can only use the render option when using the runtime-only build, but it works with single-file components, because single-file components’ templates are pre-compiled into render functions during the build step. | |
The npm package exports the runtime-only build by default. To use standalone build use the following in the webpack config file: | |
resolve: { | |
alias: { | |
'vue$': 'vue/dist/vue.common.js' | |
} | |
} | |
NOTE:: I created a runtime-only build file and was getting an error “Failed to mount component: template or render function not defined. (found in root instance)”. When I placed the above code in the webpack, everything started working fine. Bingo!! | |
I didn’t understand the reason initially but after posting a query on the Vue forum Linus Borg cleared my doubt. | |
Here is the link of the forum for more clarity: | |
https://forum.vuejs.org/t/failed-to-mount-component-template-or-render-function-not-defined-found-in-root-instance/538/8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you 👍