Skip to content

Browser Compatibility

vite-plugin-public-typescript uses esbuild and babel for compilation.

By default, it targets es2015 for esbuild and automatically detects browserslist for babel transformations.

You can modify the compatibility as follows:

esbuild target

ts
import { defineConfig } from 'vite'
import { publicTypescript } from 'vite-plugin-public-typescript'

export default defineConfig({
  plugins: [
    publicTypescript({
      esbuildOptions: {
        target: 'es2016',
      }
    })
  ]
})

esbuild target compatibility table:

TargetChromeSafariFirefoxEdge
es20154910.14514
es20165210.15214
es20175510.15215
es20186011.15579
es20196611.15879
es20208013.17280

For more esbuild options, refer to esbuild options.

browserslist

babel uses the browserslist configuration to transform code. You can create a .browserslistrc file in the project root directory.

> 0.01%
not dead
last 4 versions
not ie <= 11
defaults

babel configuration

NOTE

It is recommended to modify the browserslist configuration instead of the babel configuration.

You can modify the babel configuration through babel.

ts
import { defineConfig } from 'vite'
import { publicTypescript } from 'vite-plugin-public-typescript'

export default defineConfig({
  plugins: [
    publicTypescript({
      babel: {
        // Configuration
      }
    })
  ]
})

For more configuration options, refer to babel options.