Next Js不会为SaSS部署,SassError:找不到要导入的样式表

tjrkku2a  于 2023-06-05  发布在  其他
关注(0)|答案(2)|浏览(354)

Sass Error有问题我在Next Js上做了一个项目,当部署Vercel时,控制台返回这个错误。

Failed to compile.
./styles/app.scss.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[3].oneOf[9].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[3].oneOf[9].use[2]!./node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[3].oneOf[9].use[3]!./node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[3].oneOf[9].use[4]!./styles/app.scss
SassError: Can't find stylesheet to import.
   ╷
14 │ @import "pages/Haveproject.module.scss";
   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  styles/app.scss 14:9  root stylesheet
Import trace for requested module:
./styles/app.scss
./pages/_app.js
./styles/app.scss

但是我导入了app.scss中的SCSS文件
我的文件夹结构

我的app.js

import "../styles/globals.scss";
import "../styles/app.scss";

我的app.scss

@import "./abstracts/variables.scss";
@import "./abstracts/mixins.scss";

@import "./components/Header.module.scss";
@import "./components/Footer.module.scss";
@import "./pages/Home.module.scss";
@import "./pages/Haveproject.module.scss";

我试图改变没有点,但它没有工作。就像这样

@import "pages/Haveproject.module.scss";

我不知道我错在哪里。谢谢你

xn1cxnb4

xn1cxnb41#

使用小写字母而不是大写字母可能会导致您的错误。
应该是@import "./pages/HaveProject.module.scss",而不是@import "./pages/Haveproject.module.scss"
我们都有过这样的经历,错别字可能会让人非常沮丧。

ubby3x7f

ubby3x7f2#

你好,我知道为什么当你重命名它Projet它的工作,我只是有同样的问题,当我有一个组件命名的错误AnimationComponent和我重命名它animationComponent和它做了同样的错误,你。如果你不改变一个字母,但只是一个资本,它不起作用XD。只有当单词改变时,它才不刷新大写字母

相关问题