Vite+React+TS+Eslint+Prettier starter kit

2021-11-13 15:47:39 +08:00
 XTTX
Vite 用 es-build, 速度就不用多讲了。对比 CRA, 好多地方有不同。 我花了不少时间,搜了不少东西,做了一个自己用的 starter kit.

Vite + React + Typescript + Eslint + Airbnb eslint rules + Airbnb Typescript rules + Prettier + env variable import + Absolute Import Path


https://github.com/jt6677/vite_ts_eslint_prettier_aribnbts

==============================================
!yes, tons of setup and config files.

==============================================
env variable import:

You need to add type in env.d.ts like "readonly VITE_ANYTHING: string"
variables MUST start with VITE_
usage of env variable in your app, no need to import, just use it as a global variable: console.log(import.meta.env.VITE_API_URL)

==============================================
Absolute Import Path

import App from "~/components". ~/ is the absoulte path, equal to ./src

==============================================
reverse Proxy in vite.config.ts
2258 次点击
所在节点    Vite
1 条回复
XTTX
2021-11-13 15:48:28 +08:00
Vite + React + Typescript + Eslint + Airbnb eslint rules + Airbnb Typescript rules + Prettier + env variable import + Absolute Import Path

!yes, tons of setup and config files.

==============================================
env variable import:

You need to add type in env.d.ts like "readonly VITE_ANYTHING: string"
variables MUST start with VITE_
usage of env variable in your app, no need to import, just use it as a global variable: console.log(import.meta.env.VITE_API_URL)

==============================================
Absolute Import Path

import App from "~/components". ~/ is the absoulte path, equal to ./src

==============================================
reverse Proxy in vite.config.ts

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/815145

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX