Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Defaulting to vue.runtime.esm.js instead of vue.esm.js #674

Closed
Lyrkan opened this issue Nov 23, 2019 · 5 comments · Fixed by #763
Closed

RFC: Defaulting to vue.runtime.esm.js instead of vue.esm.js #674

Lyrkan opened this issue Nov 23, 2019 · 5 comments · Fixed by #763

Comments

@Lyrkan
Copy link
Collaborator

Lyrkan commented Nov 23, 2019

Someone on Slack had a CSP issue with Vue.js caused by the fact we alias vue$ to the full Vue.js build (vue.esm.js) that compiles templates on the client instead of using the runtime-only build (vue.runtime.esm.js).

As explained in Vue.js documentation (https://vuejs.org/v2/guide/installation.html#CSP-environments):

Some environments, such as Google Chrome Apps, enforce Content Security Policy (CSP), which prohibits the use of new Function() for evaluating expressions. The full build depends on this feature to compile templates, so is unusable in these environments.

On the other hand, the runtime-only build is fully CSP-compliant. When using the runtime-only build with Webpack + vue-loader or Browserify + vueify, your templates will be precompiled into render functions which work perfectly in CSP environments.

They also recommend using the runtime-only build:

Since the runtime-only builds are roughly 30% lighter-weight than their full-build counterparts, you should use it whenever you can. If you still wish to use the full build instead, you need to configure an alias in your bundler:

Based on those two sections I can't see any reason not to switch to vue.runtime.esm.js, but maybe I'm missing something?

@esynaps
Copy link

esynaps commented Feb 17, 2020

Current work-arround #625

@stof
Copy link
Member

stof commented Feb 17, 2020

that would actually be a matter of removing the alias, as module in the vue package.json already defaults to vue.runtime.esm.js according to their doc.

@esynaps
Copy link

esynaps commented Feb 18, 2020

Yes, it’s up to Vue to take responsibility for choosing which is the default js

@FireLizard
Copy link

FireLizard commented Apr 6, 2020

Hi @esynaps ,
why is it Vue's responsibility? Changing the alias described in the workaround is not working but how can we resolve the origin issue by @Lyrkan and his/her proposed solution?

Thank you for clarification :)

@stof
Copy link
Member

stof commented Apr 29, 2020

@FireLizard the rigth sentence should be it should be Vue's responsibility. The current status is that Encore overrides the configuration done by Vue in their metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants