Skip to content

Instantly share code, notes, and snippets.

@thecrypticace
Last active February 14, 2022 12:37
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thecrypticace/2e405ec70d3944a068e21caec59c7122 to your computer and use it in GitHub Desktop.
Save thecrypticace/2e405ec70d3944a068e21caec59c7122 to your computer and use it in GitHub Desktop.
Laravel Mix config for Vue 3 compat build
// If you're using typescript or ts-check you can alias the composition api package as well:
{
"compilerOptions": {
// … other stuff omitted for brevity …
// Ensure your base url is set
"baseUrl": ".",
"paths": {
// Add composition API to your compiler options and alias it to the vue 3 install
// The path is relative to `baseUrl` above
"@vue/composition-api": ["node_moudules/vue/dist/vue"]
}
}
}
// Tell Mix to use Vue 3 and the appropriate compat options when compiling .vue files
mix.vue({
version: 3,
options: {
compilerOptions: {
compatConfig: {
MODE: 3,
},
},
},
})
// Alias Vue and (optionally) the composition API
mix.webpackConfig(() => {
return {
resolve: {
alias: {
vue: "@vue/compat",
"@vue/composition-api": "@vue/compat",
}
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment