我有一个带aws-amplify的Next.js项目。当我做yarn build
时,出现以下错误:
> Build error occurred
{ /Users/imyjimmy/project/node_modules/@aws-amplify/ui/dist/style.css:13
:root {
^
SyntaxError: Unexpected token :
是的,我尝试在next.config.js
的顶部添加以下内容:
if (typeof require !== 'undefined') {
require.extensions['.less'] = () => {}
require.extensions['.css'] = file => {}
}
没有区别。
这是我的依赖项:
"dependencies": {
"@material-ui/core": "latest",
"@material-ui/icons": "latest",
"@material-ui/styles": "latest",
"@zeit/next-css": "^1.0.1",
"apollo-boost": "^0.1.16",
"apollo-client": "^2.4.2",
"async": "^3.1.0",
"aws-amplify": "^1.1.32",
"aws-amplify-react": "^2.3.11",
"axios": "^0.19.0",
"babel-core": "^7.0.0-bridge.0",
"clsx": "latest",
"date-fns": "^2.0.0-alpha.7",
"downshift": "^2.2.3",
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.5.0",
"graphql": "^14.0.2",
"graphql-tag": "^2.9.2",
"lodash.debounce": "^4.0.8",
"next": "latest",
"next-with-apollo": "^3.1.3",
"nprogress": "^0.2.0",
"prop-types": "latest",
"react": "latest",
"react-adopt": "^0.6.0",
"react-apollo": "^2.2.1",
"react-dom": "latest",
"react-stripe-checkout": "^2.6.3",
"react-transition-group": "^2.5.0",
"url-loader": "^2.0.1",
"webpack": "^4.39.2"
},
"devDependencies": {
"babel-jest": "^23.6.0",
"babel-plugin-module-resolver": "^3.1.1",
"casual": "^1.5.19",
"css-loader": "^3.1.0",
"enzyme-to-json": "^3.3.4",
"graphql-tools": "^4.0.0",
"jest": "^23.6.0",
"jest-transform-graphql": "^2.1.0"
},
任何帮助将不胜感激。谢谢。