react에서 사용했던 패키지를 next환경에서 써야하는 상황
next 환경에서 작동할수있도록 컴파일 해주는 패키지 발견
https://www.npmjs.com/package/next-transpile-modules
1. npm 모듈 설치
npm i next-transpile-modules
2. next.config 파일 설정하기
const config = require('config');
const { format } = require('date-fns');
const { ko } = require('date-fns/locale');
/** @type {import('next').NextConfig} */
const withTM = require("next-transpile-modules")([
"@fullcalendar/common",
"@fullcalendar/daygrid",
"@fullcalendar/interaction",
"@fullcalendar/react",
"@fullcalendar/timegrid",
]);
/** @type {import('next').NextConfig} */
const nextConfig = withTM({
reactStrictMode: true,
... 다른옵션들
});
module.exports = nextConfig;
react node-module을 컴파일해서 next환경에서도 이슈없도록 해준다.!
'NOTE' 카테고리의 다른 글
react-hook-form validate with zod (0) | 2023.08.17 |
---|---|
typescript 배열 중 하나 타입으로 선언하기 (0) | 2023.08.16 |
리액트 오류: React DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node (0) | 2023.08.05 |
string 대문자, 소문자 체크하기 (0) | 2023.05.05 |
String.charAt(index) (0) | 2023.05.05 |