How to integrate Vue in Symfony 5

415 views Asked by At

Symfony 5, Vue 2.6, Webpack 4
I have seen many guides explaining how to create a SPA, but right now I want to integrate Vue in just one view, as the app has many views and data, it would take couple of months before we can implement whole new framework in our app. Currently we are using webpack and we are having some problems with integration.So,

  1. Would you use webpack encore instead of webpack and if so, why?
  2. Our main goal is to optimize everything - what does webpack encore loads additionally that webpack doesn't have and does it contain bunch of useless stuff?
  3. Importing modules in js files - js has no way of knowing the hash that the webpack generated, so importing must be done inside twig in the script block. You can only import modules at the top level, so putting script type=module solves that issue, but then browser cannot guess the MIME type of the .vue files, even when X-Content-Type-Options=nosniff - any workaround that?
  4. Are there any other options to import asset from the webpack build including chunkhash?
0

There are 0 answers