I am working on a project(Next.js version 8.1.0) and I want to upgrade to version 9.2. I changed Next.js version to 9.2 and I am having this issue:
TypeError: Class constructor App cannot be invoked without 'new' at new MyApp (/home/node/app/src/.next/server/static/development/pages/_app.js:4384:191) at processChild (/home/node/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:2995:14) at resolve (/home/node/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:2960:5) at ReactDOMServerRenderer.render (/home/node/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:3435:22) at ReactDOMServerRenderer.read (/home/node/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:3373:29) at renderToString (/home/node/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:3988:27) at render (/home/node/app/node_modules/next/dist/next-server/server/render.js:81:16) at renderPage (/home/node/app/node_modules/next/dist/next-server/server/render.js:346:16) at Object.ctx.renderPage (/home/node/app/src/.next/server/static/development/pages/_document.js:2266:26) at Function.getInitialProps (/home/node/app/src/.next/server/static/development/pages/_document.js:1515:19) at _callee$ (/home/node/app/src/.next/server/static/development/pages/_document.js:2282:77) at tryCatch (/home/node/app/src/.next/server/static/development/pages/_document.js:428:40) at Generator.invoke [as _invoke] (/home/node/app/src/.next/server/static/development/pages/_document.js:654:22) at Generator.prototype.(anonymous function) [as next] (/home/node/app/src/.next/server/static/development/pages/_document.js:480:21) at asyncGeneratorStep (/home/node/app/src/.next/server/static/development/pages/_document.js:124:24) at _next (/home/node/app/src/.next/server/static/development/pages/_document.js:146:9)
Here is my next.config.js:
const withSass = require('@zeit/next-sass');
const { resolve } = require('path');
let baseUrl = process.env.BASE_URL;
baseUrl = baseUrl && baseUrl.length && '/' !== baseUrl ? baseUrl : '';
module.exports = withSass({
transpileModules: ['file-type'],
webpack(config, options) {
config.module.rules.push({
test: /\.tsx?$/,
use: [
{
loader: 'babel-loader',
options: {
configFile: resolve('babel.config.js'),
},
},
{
loader: 'ts-loader',
options: {
// disable type checker - we will use it in fork plugin
transpileOnly: true,
},
},
],
});
config.module.rules.push({
test: /node_modules\/file-type/,
use: [
{
loader: 'babel-loader',
options: {
configFile: resolve('babel.config.js'),
exclude: /node_modules\/(?!(file-type))/,
include: /node_modules\/file-type/,
sourceType: 'unambiguous',
},
},
],
});
config.resolve.extensions.push('.ts');
config.resolve.extensions.push('.tsx');
config.resolve.extensions.push('.jsx');
/* if (options.isServer) {
config.plugins.push(new ForkTsCheckerWebpackPlugin({ tsconfig: resolve('./tsconfig.json') }));
} */
return config;
},
pageExtensions: ['jsx', 'tsx'],
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: '[local]___[hash:base64:5]',
},
sassLoaderOptions: {
includePaths: [resolve('src/scss')],
},
webpackDevMiddleware: config => {
if (process.env.ENABLE_WATCH_POLL) {
const watchOptions = {
poll: true,
aggregateTimeout: 500,
ignored: [
'.git/**',
'src/.next/**',
'**/__tests__/**',
'.scannerwork/**',
'cypress/**',
'doc/**',
'node_modules/**',
'src/static/**',
],
};
return { ...config, watch: true, watchOptions };
}
return config;
},
publicRuntimeConfig: {
env: process.env.APP_ENV,
nodeEnv: process.env.NODE_ENV,
apiProxy: process.env.API_PROXY,
subscriptionKey: process.env.OCP_APIM_SUBSCRIPTION_KEY,
apiEndpoint: process.env.API_ENDPOINT,
serverPort: process.env.SERVER_PORT,
gmapApiendpoint: process.env.GMAP_API_KEY,
gigyaApiKey: process.env.GIGYA_API_KEY,
gigyaDatacenter: process.env.GIGYA_DATACENTER,
templateReimbursementLink: process.env.TEMPLATE_REIMBURSEMENT_LINK,
reimbursementStatusLink: process.env.REIMBURSEMENT_STATUS_LINK,
gtmId: process.env.GTM_ID,
captchaSiteKey: process.env.CAPTCHA_SITE_KEY,
baseUrl,
redisPort: process.env.REDIS_PORT,
redisHost: process.env.REDIS_HOST,
redisPassword: process.env.REDIS_PASSWORD,
},
});
MyApp
with thenew
-keyword? E.g.const app = new MyApp();
? – Argee