We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
构建时可以从以下环境中读取环境变量(优先级从低到高):
将结果作为 Rspack 配置函数 的 env 参数(以上文件的优先级低于命令行的 env 参数)。并且自动将其设置到 process.env 中。
process.env
以 create-rspack 生成的项目,应该在 .gitignore 中包含 *.local ,以保证其只在本地生效,而不被 Git 追踪。
.gitignore
*.local
参考 Vite 环境变量与模式。
The text was updated successfully, but these errors were encountered:
我看看能不能直接用plugin 解决
Sorry, something went wrong.
rspack-cli 目前的定位更偏向于 webpack-cli 不像 cra 或者 vite 所以我们可能会更加偏向使用 plugin 来支持
webpack-cli
cra
vite
https://github.com/IWANABETHATGUY/rspack-plugin-dotenv 可以试试 安装这个包,你如果有更多定制化的需求,可以fork 一份自己修改,目前我们目标是兼容 webpack 生态,为了让 webpack 用户平滑迁移,可能不会让这个 plugin 变得和 vite一样。 你可以自己修改并且适配,修改方法非常简单,IWANABETHATGUY/rspack-plugin-dotenv@b982ad2#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556R53-R59
OK,有劳了。
IWANABETHATGUY
No branches or pull requests
What problem does this feature solve?
构建时可以从以下环境中读取环境变量(优先级从低到高):
将结果作为 Rspack 配置函数 的 env 参数(以上文件的优先级低于命令行的 env 参数)。并且自动将其设置到
process.env
中。以 create-rspack 生成的项目,应该在
.gitignore
中包含*.local
,以保证其只在本地生效,而不被 Git 追踪。What does the proposed API of configuration look like?
参考 Vite 环境变量与模式。
The text was updated successfully, but these errors were encountered: