我将 Electron Forge 用于 Electron 应用程序。我也使用 React 和 TypeScript,我也想使用 SASS,但我目前的尝试失败了。显然,SASS 已经在没有向 . 添加任何新依赖项的情况下工作package.json
,因为electron-compile
它负责处理。这就是它在electronforge.io上的Develop下所说的。
我尝试style.scss
在第一个 TypeScript 类中添加作为导入app.tsx
,但添加此编译后不再起作用:
import "./style/style.scss";
导致:
[24717:0221/194746.779571:ERROR:CONSOLE(7830)] "Extension server error: Object not found: <top>", source: chrome-devtools://devtools/bundled/shell.js (7830)
我还尝试将一个link
元素放入 中的head
元素中index.html
,但这也不起作用。编译工作,但没有完成 CSS 工作:
<link rel="stylesheet" href="style/style.scss">
也试过:
<link rel="stylesheet" type="text/css" href="style/style.scss">
和:
<link rel="stylesheet" type="text/scss" href="style/style.scss">
和:
<link rel="stylesheet" type="text/sass" href="style/style.scss">
“style.scss”文件:
body {
background-color: #ff0000;
color: #0000ff;
}
但它们都不起作用。我必须做什么才能在 Electron Forge 中使用 SASS 文件?