我在我的项目结构的根目录中保留了一个styles.scss。我还使用next.config.js启用了SASS。但是,我仍然收到同样的错误。
'You may need an appropriate loader to handle this file type'
我到处都在寻找解决方案,却一无所获。似乎可能与Next / TS有关,但我不确定。这是我的next.config.ts
const withTypescript = require('@zeit/next-typescript');
const withSass = require('@zeit/next-sass');
// Add this after your declarations
module.exports = withTypescript(withSass({
sassLoaderOptions: {}
}))
还有package.json
"name": "kb",
"version": "0.1.0",
"private": true,
"dependencies": {
"@types/jest": "^24.0.17",
"@types/node": "^12.7.1",
"@types/react": "^16.9.1",
"@types/react-dom": "^16.8.5",
"@zeit/next-css": "^1.0.1",
"@zeit/next-sass": "^1.0.1",
"@zeit/next-typescript": "^1.1.1",
"axios": "^0.19.0",
"css-loader": "^3.2.0",
"next": "^9.0.3",
"node-sass": "^4.12.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-scripts": "3.1.0",
"sass-loader": "^7.2.0",
"typescript": "^3.5.3"
},
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}