question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how do vite support babel

See original GitHub issue

Does vite support babel ?

for example, when I use webpack, I can create a .babelrc file as below

by using babel-plugin-import

// .babelrc or babel-loader option
{
  "plugins": [
    ["import", { "libraryName": "ant-design-vue", "libraryDirectory": "es", "style": "css" }] 
  ]
}

and then I can just import the module from ant-design-vue,

// babel-plugin-import can help us load  js and css
import { DatePicker } from 'ant-design-vue';

instead of import the style separately, as follows:

import DatePicker from 'ant-design-vue/lib/date-picker'; // load js
import 'ant-design-vue/lib/date-picker/style/css'; // load css
// import 'ant-design-vue/lib/date-picker/style';         // load less

Describe the solution you’d like

Hope that vite can also provide a plugin similar to babel-plugin-import

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
anncwbcommented, Jan 21, 2021
1reaction
yyx990803commented, Jan 21, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to replace webpack & babel with Vite on a legacy React ...
Plus you don't need Babel if you're using Vite so you can get rid of a tonne of dependencies and security vulnerability messages....
Read more >
vite-plugin-babel - npm
Runs Babel in Vite during all commands. Latest version: 1.1.2, last published: 4 months ago. Start using vite-plugin-babel in your project ...
Read more >
is it required babel configuration when I use vite in place of ...
No, vite does automatic syntax transforms but it only targets browsers that support es modules (firefox & chrome started supporting it ...
Read more >
Plugins - Vite
Vite aims to provide out-of-the-box support for common web development patterns. ... Provides Vue 3 JSX support (via dedicated Babel transform).
Read more >
vite-plugin-babel - NPM Package Overview - Socket.dev
Most Vite plugins runs Babel only during build , not serve , and only other possible way to do this is via @vitejs/plugin-react....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found