Skip to content

yzydeveloper/vite-plugin-babel-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vite-plugin-babel-compiler

Vite runtime uses Babel compiler

Work around some experimental features not supported by Esbuild.

Install

npm i -D vite-plugin-babel-compiler

Add plugin to your vite.config.ts:

Config Decorator

npm install -D @babel/plugin-proposal-class-properties
npm install -D @babel/plugin-proposal-decorators
import babel from 'vite-plugin-babel-compiler'

{
    plugins: [
        babel({
            babel: {
                plugins: [
                        ['@babel/plugin-proposal-decorators', { legacy: true }],
                        ['@babel/plugin-proposal-class-properties', { loose: true }],
                ],
                exclude: ['dep',/path/]
                include: ['dep',/path/]
            }
        })
    ]
}