|
Hello, I create next js project with typescript template. and install styled-components with edit babelrc. I using yarn berry with stable version. I runned How can I fix this error? Please help me. package.json {
"name": "web-main",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@tanstack/react-query": "^4.0.3",
"next": "12.2.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-is": "^18.2.0",
"recoil": "^0.7.4",
"styled-components": "^5.3.5",
"styled-reset": "^4.4.2"
},
"devDependencies": {
"@babel/core": "^7.18.9",
"@babel/preset-typescript": "^7.18.6",
"@babel/runtime": "^7.18.9",
"@next/eslint-plugin-next": "^12.2.2",
"@types/babel__core": "^7.1.19",
"@types/eslint": "^8.4.5",
"@types/node": "18.0.6",
"@types/react": "18.0.15",
"@types/react-dom": "18.0.6",
"@types/styled-components": "^5.1.25",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"babel-plugin-styled-components": "^2.0.7",
"eslint": "^8.20.0",
"eslint-config-next": "12.2.2",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^2.7.1",
"typescript": "4.7.4",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0"
},
"packageManager": "yarn@3.2.1"
}next.config.js /** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
};
module.exports = nextConfig;.babelrc {
"presets": ["next/babel", "@babel/preset-typescript"],
"plugins": [
[
"styled-components",
{ "ssr": true, "displayName": true, "preprocess": false }
]
]
}tsconfig.json {
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"@src/*": ["src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}project structure |
Answered by
InTEGr8or
Aug 17, 2022
Replies: 1 comment 7 replies
|
This might be because you're in your I had the same problem with Then I found this horrible but working, solution: https://stackoverflow.com/a/72594016/927008 |
7 replies
Answer selected by
tilto0822
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This might be because you're in your
d:, as terrible of an answer as that sounds.I had the same problem with
npx next buildon my project and several projects in the Next.jsexamples/, so it's not any of the config files in the project folder.Then I found this horrible but working, solution: https://stackoverflow.com/a/72594016/927008