next.js

How to combine and use multiple Next.js plugins

纵然是瞬间 提交于 2020-03-10 04:57:12
问题 I would like to use css and scss in next.js app. I have next.config.js in my project. This configuration is for scss : // next.config.js const withSass = require('@zeit/next-sass'); module.exports = withSass({ cssModules: true, cssLoaderOptions: { importLoaders: 1, localIdentName: "[local]___[hash:base64:5]", } }) I don't know how to combine const withCSS = require('@zeit/next-css'); with my current config. I would like to use custom config for scss (from my code snipet). Can someone help me

How to combine and use multiple Next.js plugins

匆匆过客 提交于 2020-03-10 04:56:45
问题 I would like to use css and scss in next.js app. I have next.config.js in my project. This configuration is for scss : // next.config.js const withSass = require('@zeit/next-sass'); module.exports = withSass({ cssModules: true, cssLoaderOptions: { importLoaders: 1, localIdentName: "[local]___[hash:base64:5]", } }) I don't know how to combine const withCSS = require('@zeit/next-css'); with my current config. I would like to use custom config for scss (from my code snipet). Can someone help me

how to validate / lint styled-jsx in NextJS?

余生长醉 提交于 2020-03-05 06:07:31
问题 I am using nextJS for development, for stylelint to validate my .scss and .css files. I'm also using styled-jsx or css-in-js for component level styling (it's kind of requirement) and want to know if there's some library to validate styled-jsx below is the code sample of my css code. <style jsx>{` .HeadText { color: ${myColors['color-primary']}; } `} </style> I've tried using this library but it work's for only static styles like below : <style jsx>{` .HeadText { color: red; bad-property:

how to validate / lint styled-jsx in NextJS?

余生颓废 提交于 2020-03-05 06:07:10
问题 I am using nextJS for development, for stylelint to validate my .scss and .css files. I'm also using styled-jsx or css-in-js for component level styling (it's kind of requirement) and want to know if there's some library to validate styled-jsx below is the code sample of my css code. <style jsx>{` .HeadText { color: ${myColors['color-primary']}; } `} </style> I've tried using this library but it work's for only static styles like below : <style jsx>{` .HeadText { color: red; bad-property:

Initially fetch data and pass props to another component

旧时模样 提交于 2020-03-05 03:13:08
问题 I have honestly (and perhaps ashamedly) been flummoxed by this for well over a week now. I've read the Next.js documentation back to front and have scoured the web for hours. I am clearly missing something and would appreciate it if someone could take a look. When Index.js gets loaded, it sends a request to my database (via) express and this returns a json response. The intention is for my ProductList component to .map() this response - which has been passed to it via props - into my

How to inline CSS in the head tag of a NextJS project?

此生再无相见时 提交于 2020-03-05 03:03:25
问题 My NextJS project has the following Webpack configuration: import path from 'path'; import glob from 'glob'; import ExtractTextPlugin from 'extract-text-webpack-plugin'; import webpack from 'webpack'; import dotenv from 'dotenv'; import OptimizeCSSAssetsPlugin from 'optimize-css-assets-webpack-plugin'; import withSass from '@zeit/next-sass'; dotenv.config(); module.exports = withSass({ distDir: '.build', webpack: (config, { dev, isServer }) => { if (isServer) { return config; } config.plugins

Nodemailer got error: 'ECONNRESET' Code:'ESOCKET'

荒凉一梦 提交于 2020-02-25 06:20:45
问题 I tried to send mail using Nodemailer by using my mail server. It work fine in localhost:8000 buy when I deploy my project to production mode It's got error: 'ECONNRESET' fyi: I use express for the backend and deploy this project on window server 2012 This is an error error cannot sendmail: Error: read ECONNRESET at TCP.onStreamRead (internal/stream_base_commons.js:201:27) { errno: 'ECONNRESET', code: 'ESOCKET', syscall: 'read', command: 'CONN' Here is the code const nodemailer = require(

Nodemailer got error: 'ECONNRESET' Code:'ESOCKET'

梦想与她 提交于 2020-02-25 06:19:12
问题 I tried to send mail using Nodemailer by using my mail server. It work fine in localhost:8000 buy when I deploy my project to production mode It's got error: 'ECONNRESET' fyi: I use express for the backend and deploy this project on window server 2012 This is an error error cannot sendmail: Error: read ECONNRESET at TCP.onStreamRead (internal/stream_base_commons.js:201:27) { errno: 'ECONNRESET', code: 'ESOCKET', syscall: 'read', command: 'CONN' Here is the code const nodemailer = require(

How to deploy a nextjs application on cpanel?

坚强是说给别人听的谎言 提交于 2020-02-05 05:40:27
问题 I followed these steps to deploy my nextjs on cPanel. go to package.json and add this line: "homepage": "http://afsanefadaei.ir" run next build to have .next folder as my build folder go to cpanel >> file manager >> public_html folder and upload the contetn of .next folder to this directory add or edit this file: .htaccess to: but when I go to the website I face this: Do you know what is wrong with this? 回答1: Your .next doesn't have index.html file. Seems like you have server side (mostly

Nextjs Link tag points to same page causes a Refresh

北慕城南 提交于 2020-01-25 08:36:34
问题 If the user is on the Home page, clicking on the Home Page option in the Header Menu will cause a refresh and loads the same page. Using <Link as='/homepage' href='/landing'>Home Page</Link> inside the Header Layout and also a custom server to server all the URL requests. 回答1: Here is my sample code, here I have used react-router-dom instead of next.js Basically I have 3 functional component Home, Page1 and Page2 and Inside App.js I keep my route import React, { Component } from "react";