next.js

Upgrading From Create-React-App to Next.js - CSS stylesheets are not working

怎甘沉沦 提交于 2021-01-27 06:56:12
问题 Recently we found out that we have to use SSR for Our React Project. I have checked with every method that I know and almost tested all methods that I've found on medium and other sites. And after a lot of work, I decided that we have to migrate to Next JS. While the process of migrating everything is fine, but for the style sheets. In the old version of our app, we used webpack to bundle our styles with the project and everything was fine. This is the webpack.config.js const

Upgrading From Create-React-App to Next.js - CSS stylesheets are not working

不打扰是莪最后的温柔 提交于 2021-01-27 06:51:49
问题 Recently we found out that we have to use SSR for Our React Project. I have checked with every method that I know and almost tested all methods that I've found on medium and other sites. And after a lot of work, I decided that we have to migrate to Next JS. While the process of migrating everything is fine, but for the style sheets. In the old version of our app, we used webpack to bundle our styles with the project and everything was fine. This is the webpack.config.js const

fsevents causes Module parse failed: Unexpected character '�'

前提是你 提交于 2021-01-27 05:22:18
问题 I am using next.js and I get: Failed to compile. ./node_modules/fsevents/fsevents.node 1:0 Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders (Source code omitted for this binary file) I tried almost everything, most recently, to package.json , I added: "optionalDependencies": { "fsevents": "^2.1.3" } In next.config.js , I have:

Asked to install Typescript when already installed when building Docker image

纵然是瞬间 提交于 2021-01-26 11:38:49
问题 I am trying to build a docker image of a Next.js/React application which uses Typescript. Typescript is installed, and I am able to run a build locally without docker. However, as the docker image is building, I get to the following point: Step 8/10 : RUN npm run build ---> Running in ee577c719739 > project@0.0.5 build /app > next build Creating an optimized production build... Attention: Next.js now collects completely anonymous telemetry regarding usage. This information is used to shape

Asked to install Typescript when already installed when building Docker image

折月煮酒 提交于 2021-01-26 11:38:05
问题 I am trying to build a docker image of a Next.js/React application which uses Typescript. Typescript is installed, and I am able to run a build locally without docker. However, as the docker image is building, I get to the following point: Step 8/10 : RUN npm run build ---> Running in ee577c719739 > project@0.0.5 build /app > next build Creating an optimized production build... Attention: Next.js now collects completely anonymous telemetry regarding usage. This information is used to shape

How I can use my jquery plugin in Next.js?

泪湿孤枕 提交于 2021-01-21 10:33:09
问题 i'm developing web app using Next.js and I'd like to use jQuery in Next.js. But I can't import jquery plugin. please check my code and Help me. import React from 'react'; import Document, { Head, Main, NextScript } from 'next/document'; import { ServerStyleSheet } from 'styled-components'; export default class MyDocument extends Document { static getInitialProps({ renderPage }) { const sheet = new ServerStyleSheet(); const page = renderPage(App => props => sheet.collectStyles(<App {...props}

How to handle breadcrumbs?

六眼飞鱼酱① 提交于 2021-01-21 09:52:27
问题 I am making a simple react/next js application where I am having totally three pages. -> index.js -> jobsearch.js -> jobdescription.js Scenario: -> In home page there is two option for user, One: They can directly click on any job and go to job description page. Two: They can go to job search page and the by cliking on any job in search page, they can go to job description page And finally when user reached the job description page, the breadcrumb is shown like, <nav className="container">

NextJS on GAE - Error: EROFS: read-only file system

筅森魡賤 提交于 2021-01-07 07:04:20
问题 I'm trying to deploy a Next application with custom server.js into GAE. I can run the project with no problems on local and even on the google GCP CLI. The problem right now is after the app is deployed to GAE successfully via gcloud app deploy , I'm getting the following error when opening the app. 2020-03-30 21:41:21.748 HKT Error: EROFS: read-only file system, unlink '/srv/dist/functions/next/BUILD_ID' Expand all | Collapse all{ insertId: "5e81f701000b6ba4e770be02" labels: {…} logName:

NextJS on GAE - Error: EROFS: read-only file system

雨燕双飞 提交于 2021-01-07 07:03:54
问题 I'm trying to deploy a Next application with custom server.js into GAE. I can run the project with no problems on local and even on the google GCP CLI. The problem right now is after the app is deployed to GAE successfully via gcloud app deploy , I'm getting the following error when opening the app. 2020-03-30 21:41:21.748 HKT Error: EROFS: read-only file system, unlink '/srv/dist/functions/next/BUILD_ID' Expand all | Collapse all{ insertId: "5e81f701000b6ba4e770be02" labels: {…} logName:

NextJS: Use same component in multiple routes for multiple pages

老子叫甜甜 提交于 2021-01-07 03:07:14
问题 In my NextJS app, I have a search bar component OrderSearchBar.js and I want to use it in both index.js and /purchases.js pages but with different endpoints.For example,if I click search button on the index.js page,it should post form content to /orders and on the /purchases.js , form content should post to /purchaseDetails.Is there any way to accomplish this? OrderSearchBar.js class OrderSearchBar extends Component{ constructor(props) { super(props); this.onChangeInput = this.onChangeInput