Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
vite-plugin-babel-dev
Advanced tools
Run babel during dev server in Vite.
Vite comes with Babel out of box, but runs it only during build
and only other possible why to do this is via @vitejs/plugin-react. ESBuild is awesome tool, but doesn't support some experimental features, like decorators (issue #2349) or class instance fields, out of box. You can use them only in TypeScript, but not pure JS. This plugin was made to enable usage of such features and runs babel during optimizeDeps
and dev
stages.
# yarn
yarn add -D vite-plugin-babel-dev
# npm
npm install -D vite-plugin-babel-dev
Add it to your Vite config
import { defineConfig } from 'vite';
import babelDev from 'vite-plugin-babel-dev';
export default defineConfig({
plugins: [
babelDev({
babelConfig: {
plugin: ['@babel/plugin-proposal-decorators']
}
}),
// ...
],
// ...
})
Babel config can be either passed to babelConfig
field or via .babelrc
type of file. For all babel options see: Babel Options.
By default, babel is run only for JS/JSX files. You can change that vie filter
option.
Name | Type | Default | Description |
---|---|---|---|
babelConfig | object | {} | Babel Options |
filter | RegExp | /\.jsx?$/ | wich files is babel applied to. By default it's js/jsx files |
Vite team didn't enabled it by default, because they wanted to keep dev environment as fast as possible. Because of that, we recommend to only include those Babel plugins you really need. You can use option babelConfig.plugin
and disable usage of babel config file, ex.:
babelDev({
babelConfig: {
babelrc: false,
configFile: false,
plugin: ['@babel/plugin-proposal-decorators']
}
})
or just use .babelrc.json
that will be also used during build process.
NOTE: Any babel plugins and presets need to be installed seperately and are not included with this package.
Library is under MIT License
FAQs
Runs babel during dev serve in Vite
The npm package vite-plugin-babel-dev receives a total of 172 weekly downloads. As such, vite-plugin-babel-dev popularity was classified as not popular.
We found that vite-plugin-babel-dev demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.