2022.04.26 - [Structure] - monorepo use yarn berry with nextjs, react storybook + typescript - 3 (react + stroybook + typescript)

 

monorepo use yarn berry with nextjs, react storybook + typescript - 3 (react + stroybook + typescript)

2022.04.26 - [Structure] - monorepo use yarn berry with nextjs, react storybook + typescript - 2 (nextjs + typescript 추가) monorepo use yarn berry with nextjs, react storybook + typescript - 2 (nex..

mugon-devlog.tistory.com

현재 프로젝트 구조

next js에 참조할 project 추가

next js package.json 의 dependencies에 추가할 project의 package.json의 name 추가

next js의 next.config.js에 사용할 모듈 알려주기

next js 패키지에 next-transpile-modules 추가

yarn workspace web add -D next-transpile-modules

next.config.js 수정

아래와 같이 사용할 모듈 추가

const withTM = require("next-transpile-modules")(["@common/components"]);
const nextConfig = {
  reactStrictMode: true,
};

module.exports = withTM(nextConfig);

pages/index.tsx

아래와 같이 import하여 사용

728x90

+ Recent posts