tailwindcss 4 集成vite报错:Failed to resolve "@tailwindcss/vite".
安装官网文档操作如下:
Install tailwindcss
and @tailwindcss/vite
via npm.
bash
npm install tailwindcss @tailwindcss/vite
Configure the Vite plugin
bashit
# vite.config.ts
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [
tailwindcss(),
],
})
Import Tailwind CSS
Add an @import
to your CSS file that imports Tailwind CSS.
bash
@import "tailwindcss";
以上是官网的集成步骤,然而启动后报错:
Failed to resolve "@tailwindcss/vite". This package is ESM only but it was tried to load by require
. See https://vite.dev/guide/troubleshooting.html#this-package-is-esm-only for more details. [plugin externalize-deps]
解决方案
将 vite.config.js/vite.config.ts
重命名为 vite.config.mjs/vite.config.mts
Github镜像站, 2025年1月最新可用!国内更快部署下载(1月更新)
GitHub 镜像可用站点
镜像 | 访问 | 链接 | 可用 |
---|---|---|---|
GitHub镜像站014 | 直接 | https://bgithub.xyz | 可用 |
GitHub镜像站013 | 直接 | https://kkgithub.com | 可用 |
GitHub镜像站012 | 直接 | https://gitclone.com | 可用 |
GitHub镜像站011 | 直接 | https://github.hscsec.cn | 不可用 |
GitHub镜像站010 | 直接 | https://git.homegu.com | 不可用 |
GitHub镜像站009 | 直接 | https://github.ur1.fun | 可用 |
请特别注意:
导航立足学术公益,仅为方便科研工作而提供学术网址导航。
Windows 系统安装gcc, Using GCC with MinGW
因为Rust默认使用的C语言依赖Visual Studio,但该工具占用空间大安装也较为麻烦,可以选用轻便的mingw64包。
可以通过一下方式安装:
(1) 下载地址1-GitHub:Releases · niXman/mingw-builds-binaries · GitHub
(2) 下载地址2-WinLibs:WinLibs - GCC+MinGW-w64 compiler for Windows
(3) Installing the MinGW-w64 toolchain: https://code.visualstudio.com/docs/cpp/config-mingw#_installing-the-mingww64-toolchain
推荐通过第三种方式。
安装完成后记得设置环境变量。
如何在线查看mp4视频的编码格式,是否为iOS兼容的h264格式
记录一下,可以在线查询mp4编码格式的网站:
通常H264的格式的文件编码信息如下:
Movie Info
File Size / Bitrate: 0 bytes / 0 kbps
Duration / Timescale: 220845/1000 (0:03:40.845)
Brands (major/compatible): isom,isom,iso2,avc1,mp41
MIME: video/mp4; codecs="avc1.42c01f,mp4a.40.2"; profiles="isom,iso2,avc1,mp41"
Progressive: false
Fragmented: false
MPEG-4 IOD: false
重点查看MIME类型是否为video/mp4,是否包含avc信息。且 Progressive/Fragmented/MPEG-4 IOD 三个参数为false。
另外iOS支持的编码格式可以通过官方查看:
https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/FrequentlyAskedQuestions/FrequentlyAskedQuestions.html
What are the specifics of the video and audio formats supported?
Although the protocol specification does not limit the video and audio formats, the current Apple implementation supports the following formats:
-
Video:
H.264 Baseline Level 3.0, Baseline Level 3.1, Main Level 3.1, and High Profile Level 4.1. -
Audio:
HE-AAC or AAC-LC up to 48 kHz, stereo audio
MP3 (MPEG-1 Audio Layer 3) 8 kHz to 48 kHz, stereo audio
AC-3 (for Apple TV, in pass-through mode only)