Skip to content
Advertisement

Tag: next.js

Using baseUrl in jsconfig.json is not working with Next.js

jsconfigerror is an example repository showing the jsconfig is not working. I have the following set inside my jsconig.json file: However, when I do an import, it fails: Folder Structure pages/index.js How can I get baseUrl to work with Next.js? Answer Since Next.js 9.4, Next.js automatically supports the tsconfig.json and jsconfig.json “paths” and “baseUrl” options. Read more in the official

How to configure next.config.js file on right way

In my next.config.js I have the following configuration: Last thing which I need to add here is next-fonts plugin. I am not sure how to export withFounts in the right way. I need next-fonts plugin to be able to use ‘fonts’ icons. Answer You can do this: You can try to use next-compose

How to import SVG into Next.js component?

I am trying to import an SVG image from file into a Next.js component. In the assets folder I have google.svg (icon): I need to import that SVG inside of this inside of the Next.js component: I installed this package: https://www.npmjs.com/package/next-images and set configuration based on that documentation in next.config.js: Why my import of SVG does not work? Answer Another

Setting custom directory for server files for Next.js

Rather than in the root directory, I want to keep all my backend related files inside a folder named ‘server’. The problem is now the frontend won’t load properly as it can’t find the ‘pages’ directory. I remember there was a way to set the directory somehow when initializing the app but I don’t remember the specifics. Can someone please

How to config appWithTranslation(nexti18next + withRedux (next-redux-wrapper) in __app.js

I’m tranfer reactjs project to nextjs with react-redux, redux, nexti18next, next-redux-wrapper here is _app.js and redux.js it run right but if i add withRedux it is error. Please tell me how to resolve this problem or advide me some solution! Answer Here is example of NextJS/Typescript/Redux/Styled-Components/next-i18next app sample. and I have path alias in tsconfig hope this helps somebody!

Jest test: Cannot find module, in typescript component import

The path to my styled objects is correct, however not sure why I’m getting the following error: Cannot find module ‘../../shared/models’ from ‘Astronaut.tsx’ import { moonHoldings } from ‘../../shared/models’; My simple Jest test: The Astronaut component The Jest config section of my Package.json And my folder structure: Answer Ok I just fixed this by created an index file inside of

Dynamic Import Node Module With Next.js

I was getting an error of window undefined when using react-leaflet node module because it relies on window and of course SSR does not support window. I found next/dynamic, however, all the examples I found show how to import a component and not a node module. Is it possible to include a node module and if so how? As an

Advertisement