I have a Next.js project that has some pages written in plain JS. A colleague added some testing for TS, but no TS used for the pages and the components yet.
I fetch the files out of a git repo and do npm install and then npm run dev
After the npm run dev I get
./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
If I try to access localhost:3000 is blank and in the terminal I also get
./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
warn - ./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
wait - compiling / (client and server)...
warn - ./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
warn - ./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
wait - compiling /_error (client and server)...
warn - ./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
ReferenceError: regeneratorRuntime is not defined
at eval (webpack-internal:///./node_modules/next/dist/shared/lib/router/router.js:584:53)
at eval (webpack-internal:///./node_modules/next/dist/shared/lib/router/router.js:1007:6)
at eval (webpack-internal:///./node_modules/next/dist/shared/lib/router/router.js:1806:2)
at Object../node_modules/next/dist/shared/lib/router/router.js (/home/nick/Documents/myproject/.next/server/pages/_app.js:143:1)
at __webpack_require__ (/home/nick/Documents/myproject/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///./node_modules/next/dist/client/link.js:24:15)
at Object../node_modules/next/dist/client/link.js (/home/nick/Documents/myproject/.next/server/pages/_app.js:66:1)
at __webpack_require__ (/home/nick/Documents/myproject/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///./node_modules/next/link.js:1:18)
at Object../node_modules/next/link.js (/home/nick/Documents/myproject/.next/server/pages/_app.js:207:1)
ReferenceError: regeneratorRuntime is not defined
at eval (webpack-internal:///./node_modules/next/dist/shared/lib/router/router.js:584:53)
at eval (webpack-internal:///./node_modules/next/dist/shared/lib/router/router.js:1007:6)
at eval (webpack-internal:///./node_modules/next/dist/shared/lib/router/router.js:1806:2)
at Object../node_modules/next/dist/shared/lib/router/router.js (/home/nick/Documents/myproject/.next/server/pages/_app.js:143:1)
at __webpack_require__ (/home/nick/Documents/myproject/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///./node_modules/next/dist/client/link.js:24:15)
at Object../node_modules/next/dist/client/link.js (/home/nick/Documents/myproject/.next/server/pages/_app.js:66:1)
at __webpack_require__ (/home/nick/Documents/myproject/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///./node_modules/next/link.js:1:18)
at Object../node_modules/next/link.js (/home/nick/Documents/myproject/.next/server/pages/_app.js:207:1)
error - ReferenceError: regeneratorRuntime is not defined
My package.json file is
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start -p 80",
"lint": "next lint",
"test": "jest"
},
"dependencies": {
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@material-ui/core": "^4.12.3",
"@mui/icons-material": "^5.3.1",
"@mui/material": "^5.3.1",
"@next/eslint-plugin-next": "^12.0.8",
"@tsconfig/node16": "^1.0.2",
"next": "12.0.7",
"react": "17.0.2",
"react-dom": "17.0.2",
"typescript": "^4.5.4"
},
"devDependencies": {
"eslint": "^8.7.0",
"eslint-config-next": "^12.0.7",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"jest": "^27.4.7"
}
}
tsconfig.json file is
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
and babel.config.js is
module.exports = {
presets:[
"@babel/preset-env",
"@babel/preset-react"
]
}
Please help me fix this, I dont know how .
Thanks