Skip to content

How to implement two Vue apps on the same page #10777

Closed Answered by LinusBorg
sdlambert asked this question in Help/Questions
Discussion options

You must be logged in to vote

Assume no changes to the vite config [...] which means everything should be wrapped in an IIFE

Here's your misunderstanding. The default build output of Vite is an ESM module (and ESM module code runs scoped to the module if loaded as a module), hence why the documentation states that native ESM support in the browser is required for the default:

https://vitejs.dev/guide/build.html#browser-compatibility

You can also have a look in the final index.html file that should be part of the the build artifacts in /dist, and will see that the JS files are being integrated as esm modules:

<script type="module" src="...."></script>

You likely did not set type="module" when you integrated the Javas…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@sdlambert
Comment options

Comment options

You must be logged in to vote
4 replies
@sdlambert
Comment options

@LinusBorg
Comment options

Answer selected by sdlambert
@sdlambert
Comment options

@Yordan-Ramchev
Comment options

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