PARCELJS V2将React文件构建到没有CSS的单个文件中

发布于 2025-01-18 05:43:49 字数 472 浏览 3 评论 0原文

以前,在 Parcel V1 中,当我运行 parcel build src/results/results.js --out-file results.min.js --dist-dir src/theme/assets/ 时,Parcel 会捆绑我的结果文件到 results.min.js 中,出于某种未知的原因,他们删除了此功能。

现在,当我删除 --out-file 参数时,它会捆绑为 results.js 并且还会生成随机 results.css - 这似乎来自我正在使用的 node_module,并导入到我的主样式表中 - 我的样式是在 Parcel 外部处理的,因此该文件正在清除我自己的 CSS 文件。我似乎无法找到一种方法来阻止它这样做。

我在 Shopify 主题中使用它,因此我有多个 React 文件,这些文件旨在构建到它们自己的单独文件中。

Previously, in Parcel V1, when I ran parcel build src/results/results.js --out-file results.min.js --dist-dir src/theme/assets/, Parcel would bundle my results file into results.min.js, for some unknown reason, they've removed this functionality.

Now, when I remove the --out-file argument, it bundles as results.js and a random results.css is also being produced - this seems to be coming from a node_module I'm using, and importing into my main stylesheet - my styles are handled outside of Parcel so this file is wiping out my own CSS file. I can't seem to find a way to prevent it from doing this.

I'm using this within a Shopify theme so I have multiple React files that are intended to build into their own individual files.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文