Subscribe on changes!

First created app's config.compilerOptions applies to all later apps

avatar
Nov 16th 2023

Vue version

3.3.8

Link to minimal reproduction

https://codepen.io/markrian/pen/JjxOmrw?editors=1011

Steps to reproduce

  1. Create two apps via createApp
  2. Configure the second one of them to use custom compilerOptions
  3. Observe those compilerOptions are ignored on the second app, as if you didn't set them.

OR

  1. Create two apps via createApp
  2. Configure the first one of them to use custom compilerOptions
  3. Observe those compilerOptions also apply (incorrectly) to the second app.

What is expected?

Each app should respect only its own compilerOptions.

What is actually happening?

It looks like apps share compilerOptions in some way.

System Info

No response

Any additional comments?

In my minimal reproduction I only test whitespace: 'preserve'. I don't actually know if it applies to all compilerOptions or just that one - I've made an assumption about the effects here.

avatar
Nov 16th 2023

Ah, I think I see what's going on here.

Apps share a cache of compiled templates, so the first app caches the generated render function, and the second app returns it.

Would it make more sense for each app to have its own compiler cache, for exactly this reason of differing compilerOptions? Or maybe splitting the cache based on compilerOptions?