next.js

Nextjs fails to find valid build in the '.next' directory in production node_env

五迷三道 提交于 2019-12-05 02:38:37
I am running my app in docker, but my production build and start script fails only in docker environment. Although node_env development works well in docker environment. Here is my script that fails to make a production build and start a server. I am using nodemon and babel "build:prod": { "command": "babel ./src/server/ -d server --presets es2015,stage-2 && next build src", "env": { "NODE_ENV": "production" } }, "start:prod": { "command": "PORT=3000 nodemon --watch ./src/server/ ./src/server/server.js --exec babel-node --presets es2015,stage-2", "env": { "NODE_ENV": "production" } } But when

Next.js (React) & ScrollMagic

拈花ヽ惹草 提交于 2019-12-05 00:01:21
I would like to implement an animation to fade sections, like in this example , into my application. Therefore I've had a look at fullPage.js. However, since I need to integrate it into a Next.js React app with server-side rendering I can't use it since it relays on jQuery, which doesn't support SSR. Therefore I've tried my luck with ScrollMagic , which doesn't relay on jQuery. But it also doesn't support SSR (needs window ), therefore I've initialized it in the componentDidMount() method and even loaded it there (like it's recommended here ). It currently works initially, but as soon as you

How to use MongoDB Stitch Auth in isomorphic or SSR app?

对着背影说爱祢 提交于 2019-12-04 18:09:35
Would like to use Stitch in a NextJS app (basically isomorphic react). Normally, you would be able to pass a JWT or session token in the headers of the initial request, and if the user already has a session you can immediately load all of their data and hydrate the app on the server. With Google Firebase Auth you can even do this by passing a token in the request and collecting the user on the server side using that token. I'm not sure how this would work with Stitch, though. Documentation says Stitch creates a token that's stored in local storage. Is there anyway to pass this to the server to

NextJS auth with an external server

安稳与你 提交于 2019-12-04 17:42:41
I'm working with auth in Nextjs, I'm wondering what is the best strategy to handle authentication in NextJS ? Here my services structure : If I understand well I have to handle the server side rendering in NextJS, so I understand I have to put cookies from my external server to my NextJS client, then handle the server side rendering checkings. To do that I assume I have to create connection between the NextJS server and the other services. Before dive more deeper in the subject I would discuss with you about the possibilities available to me. It seems the NextJS auth is a subject in plain

Using reactstrap with Next.js

ぐ巨炮叔叔 提交于 2019-12-04 16:56:07
问题 I am creating a React app using Next.js and am trying to use components provided by reactstrap . The issue I seem to be running into seems to involve importing the CSS file named bootstrap/dist/css/bootstrap.min.css as the reactstrap guide says to do. The error I am seeing is Error in bootstrap/dist/css/bootstrap.min.css Module parse failed: Unexpected token (6:3) You may need an appropriate loader to handle this file type. Does anyone know what I have to do to make this work correctly? I am

Rendering external HTML/React components dynamically in React

梦想的初衷 提交于 2019-12-04 10:38:15
问题 Is it possible to take HTML/JSX content from an external source and render it in dynamically in React? In our case we want to take content from the Wordpress API and render it on both the client and the server (we're using NextJS) So, the Wordpress API returns a JSON response which includes a content property which is a string of HTML/JSX. the content would look something like this. { content: "<div><Slider imageCount="5" galleryID="1"></Slider><span>This is an image gallery</span></div>" }

Converting Object Promise to String in Javascript

巧了我就是萌 提交于 2019-12-04 03:49:22
问题 I'm working with React, Next.Js, semantic-ui-react and Solidity. It is my goal to print out the users address (from MetaMask) and a ProjectTitle (set by User) as meta infomation for a semantic-ui-react card. To print out the address in the 'header' is working, but I'm not able to print out the ProjectTitle as 'meta'. The Title should be a String but I'm receiving a Object Promise. static async getInitialProps() { const projects = await factory.methods.getDeployedProjects().call(); return {

React NextJS Firebase error refresh Firebase App named '[DEFAULT]' already exists

别等时光非礼了梦想. 提交于 2019-12-03 18:14:25
问题 I started a project based on https://github.com/zeit/next.js/tree/v3-beta/examples/with-firebase The error I have when importing firebase in more than one component. In this firebase start file: import firebase from 'firebase' const firebaseConfig = { apiKey: "fdsfsdfdsf", authDomain: "fdsfdsfsdfdsf", databaseURL: "sdfdsfdsf", projectId: "dsfdsfdsf", storageBucket: "dsfdsfdsf", messagingSenderId: "dsfdsfsdfdsf" } const FbApp = firebase.initializeApp(firebaseConfig) export default FbApp.auth()

Window is not defined in NextJS React app?

让人想犯罪 __ 提交于 2019-12-03 12:42:38
问题 In my NextJS app I can't seem to access window Unhandled Rejection (ReferenceError): window is not defined componentWillMount() { console.log('window.innerHeight', window.innerHeight); } 回答1: Move the code from componentWillMount() to componentDidMount() : componentDidMount() { console.log('window.innerHeight', window.innerHeight); } In NextJS, componentDidMount() is executed only the client where window and other browser specific APIs will be available. From the NextJS wiki: Next.js is

Window is not defined in NextJS React app?

元气小坏坏 提交于 2019-12-03 07:15:17
In my NextJS app I can't seem to access window Unhandled Rejection (ReferenceError): window is not defined componentWillMount() { console.log('window.innerHeight', window.innerHeight); } Move the code from componentWillMount() to componentDidMount() : componentDidMount() { console.log('window.innerHeight', window.innerHeight); } In NextJS, componentDidMount() is executed only the client where window and other browser specific APIs will be available. From the NextJS wiki : Next.js is universal, which means it executes code first server-side, then client-side. The window object is only present