question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to utilize vue-runtime build?

See original GitHub issue
  • Laravel Mix Version: 1.3.0
  • Node Version: 6.11.1
  • NPM Version: 3.10.10
  • OS: Linux

Description:

Vue comes with a runtime build which allows for CSP compliance.

Steps To Reproduce:

The following addition to the webpack.mix.js allows mix to use the runtime version:

mix.webpackConfig({
    resolve: {
        alias: {
            'vue$': 'vue/dist/vue.runtime.js'
        }
    }
});

This compiles the resources find but does not work during runtime as the templates are not compiled to render functions. In the link above, it is suggested that webpack + vue-loader can be used to pre-compile the templates.

However, I couldn’t find a way to do this. It would be great if this could be included in the docs. If it is already included, please forgive my ignorance and point me to it 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:13

github_iconTop GitHub Comments

4reactions
DrJonkicommented, Jul 27, 2017
<my-cookie-banner>
</my-cookie-banner>

There’s your problem. You’re sending HTML with a custom element, which Vue will pick up on, but being unable to handle rendering it, missing the template compiler and all 😛

Try something like this:

const root = require('./components/MyCookieBanner.vue');
const app = new Vue({
  el: '#app',
  render: createElement => createElement(root) //< The important line
});

EDIT: In addition you shouldn’t have anything inside <div id="app">

1reaction
sgmobarakcommented, Aug 14, 2021

I have used this below code and it’s official mix .js(‘resources/js/app.js’, ‘public/js’).vue() .postCss(‘resources/css/app.css’, ‘public/css’, [ // ]);

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Question] How to utilize vue-runtime build? #1052 - GitHub
Vue comes with a runtime build which allows for CSP compliance. Steps To Reproduce: The following addition to the webpack.mix.js allows mix to ......
Read more >
webpack - You are using the runtime-only build of Vue where ...
You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions ...
Read more >
Compile Vue.js templates on the Fly with v-runtime-template
A brief guide on using v-runtime-template to render Vue templates on the fly, just like v-html does with plain HTML.
Read more >
Frequently Asked Questions - Vue.js
You can learn more about how Vue automatically optimizes runtime performance in the ... When you use a build tool, many of Vue's...
Read more >
Vue.js Interview Questions & Answers - Part 2 | Eol Nuha Blogs
You can also define a filter globally before creating the Vue instance. ... In this case you can use runtime-only builds with Webpack...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found