
Class101 UI 테스트
https://ui.class101.dev/
next.js로 시도해보기로 했다. 하면서 발생한 에러들 정리
npx create-next-app .
npm install @class101/ui
npm install --save @class101/ui으로 적혀있으나 npm5부터 --save는 디폴트
index.js
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
import { Button } from '@class101/ui';
export default function Home() {
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<Button>Hello, world!</Button>
</div>
)
}
버튼 나오게 index.js구성
npm run dev
SyntaxError "Unexpected token 'export'"
next-transpile-modules 설치
npm install next-transpile-modules
next.config.js
// module.exports = {
// reactStrictMode: true,
// }
// next.config.js
const withTM = require('next-transpile-modules')(['@class101/ui']); // pass the modules you would like to see transpiled
module.exports = withTM({});
ReferenceError: regeneratorRuntime is not defined
regenerator-runtime설치
npm i --dev regenerator-runtime
index.js에 최상단에 추가
import 'regenerator-runtime';
-.-; 에러는 이제 안뜨지만 vs코드에서 수정하면 css가 잘 먹지만
새로고침하면 css가 다 날아간다.
그런데 npm run build / npm run start하면 잘 나온다;