Vite: Non-ESM is not supported by default. Will this prevent Vite from becoming popular?

Created on 22 Jul 2020  路  3Comments  路  Source: vitejs/vite

Is your feature request related to a problem? Please describe.
I tried to use Vite + React + Antd to create a new project锛孉long the way, as more dependency packages were added, I had to deal with whether each dependency package was ESM or not. This process is a bit painful because there are a lot of packages in the community that are not ready for ESM

Describe the solution you'd like
Supported non-ESM by default or enable by config option

Most helpful comment

The goal of Vite is not trying to be popular. The goal is to push the ecosystem to use ESM.

All 3 comments

Vite construct base on esm, the non-esm is actually not support by default.Other, there are already has way to support non-esm, you can use optimizeDeps: { include: [xxxx] } to pre-bundle non-esm, but it's not recommand, you should ask export esm from package maintainer .

I tried to use Vite + React + Antd to create a new project

You can have a start with https://github.com/vitejs/create-vite-app react preset.

The goal of Vite is not trying to be popular. The goal is to push the ecosystem to use ESM.

Is there more documentation on optimizeDeps?

Is the following terminal output related to optimizeDeps?

[vite] Optimizable dependencies detected:
react-responsive, react-spring

What exactly is meant by "pre-bundling non-ESM"?

Thanks!

Was this page helpful?
0 / 5 - 0 ratings