Does vite has Provide plugin like wepback?

173 views Asked by At

I have vue2 app with webpack and i want to move it to vite. But i cant provide vue globally.

For example i have this code snippet

new Vue({
    delimiters: ['${', '}'],
    el: '#app',
});

If i run vite build - it's not compile vue to js like if i'll add vue import

import Vue from 'vue'
            
new Vue({
  delimiters: ['${', '}'],
  el: '#app',
});

i'v tried to add

 plugins: [
        vue(),
 ],

or

rollupOptions: {
   external: ['vue'],
   ...
}

or add globals

output: {
    globals: {
    vue: 'Vue',
  }
}

But all of this not working. So how i can use vite like webpack with ProvidePlugin

0

There are 0 answers