front 서버에서 next 빌드할때 웹팩 에러가 발생합니다..ㅠ.ㅠ
front 서버에서 npm run build 로 next 빌드를 할때 아래와 같은 에러가 발생합니다
/////////////////////////////////////////////////////////////
root@ip-172-31-16-162:/home/ubuntu/testAWS/front# npm run build
> react-nodebird-front@1.0.0 build /home/ubuntu/testAWS/front
> cross-env ANALYZE=true next build
Creating an optimized production build ...
Webpack Bundle Analyzer saved report to /home/ubuntu/testAWS/front/.next/analyze/server.html
Failed to compile.
./node_modules/@ant-design/icons/lib/dist.js 5:6
Module parse failed: 'import' and 'export' may only appear at the top level (5:6)
You may need an appropriate loader to handle this file type.
| // 加载script标签会阻塞js执行,antd部分组件(如表格)无法在一轮循环内完成完整的渲染,故延时
| setTimeout(function(){
> import(/* webpackChunkName: "antd-icons" */'!!./dist.js').then(function(allIcons) {
| AutoReloadIcon.load(allIcons);
| });
> Build error occurred
Error: > Build failed because of webpack errors
at Object.build [as default] (/home/ubuntu/testAWS/front/node_modules/next/dist/build/index.js:192:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-nodebird-front@1.0.0 build: `cross-env ANALYZE=true next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-nodebird-front@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-28T22_17_04_628Z-debug.log
///////////////////////////////////////////////////
next.config.js 를 삭제하여 기본값으로 next 빌드를 할때는 문제없이 빌드가 되는데 왜 next.config.js로 웹팩 옵션을 추가할때는 왜 안되는지 모르겠습니다 ..ㅠ.ㅠ
답변 7
0
아... 제가 습관적으로 npm audit 를 해서 버전업이 되서 그런것 같습니다 ..^^;;;;
선생님 코드에서 몇가지 수정한것만 붙여넣으니 빌드가 잘 됩니다
답변 감사합니다!
0
답변감사합니다 제로초 선생님.
확인해보니 4.41로 되어있어서, 링크처럼 package.json에서 4.28로 설치하고 package-lock.json 을 확인해보니 4.29로 웹팩이 설치되었는데
여전히 같은 에러가 발생합니다..ㅠ.ㅠ
////////////////////////////////////////
root@ip-172-31-16-162:/home/ubuntu/testAWS/front# cat package-lock.json | grep "webpack"
"webpack-bundle-analyzer": "3.0.3"
"autodll-webpack-plugin": {
"resolved": "https://registry.npmjs.org/autodll-webpack-plugin/-/autodll-webpack-plugin-0.4.2.tgz",
"webpack-merge": "^4.1.0",
"webpack-sources": "^1.0.1"
"compression-webpack-plugin": {
"resolved": "https://registry.npmjs.org/compression-webpack-plugin/-/compression-webpack-plugin-2.0.0.tgz",
"webpack-sources": "^1.0.1"
"autodll-webpack-plugin": "0.4.2",
"webpack": "4.29.0",
"webpack-dev-middleware": "3.6.0",
"webpack-hot-middleware": "2.24.3",
"webpack-sources": "1.3.0",
"webpack": {
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.29.0.tgz",
"terser-webpack-plugin": "^1.1.0",
"webpack-sources": "^1.3.0"
"webpack-sources": {
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz",
"terser-webpack-plugin": {
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz",
"webpack-sources": "^1.4.0",
"webpack": {
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.42.1.tgz",
"terser-webpack-plugin": "^1.4.3",
"webpack-sources": "^1.4.1"
"webpack-ant-icon-loader": {
"resolved": "https://registry.npmjs.org/webpack-ant-icon-loader/-/webpack-ant-icon-loader-1.0.8.tgz",
"webpack-bundle-analyzer": {
"resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-3.0.3.tgz",
"webpack-cli": {
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.11.tgz",
"webpack-dev-middleware": {
"resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-3.6.0.tgz",
"webpack-log": "^2.0.0"
"webpack-hot-middleware": {
"resolved": "https://registry.npmjs.org/webpack-hot-middleware/-/webpack-hot-middleware-2.24.3.tgz",
"webpack-log": {
"resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-2.0.0.tgz",
"webpack-merge": {
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz",
"webpack-sources": {
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz",
///////////////////////////////////
next 10 이상에서는 redux dev tool 구동이 안되나요?
0
272
1
세션 갱신 문의 건
0
482
7
배포 진행 후 Highlight updates components render 표시
0
445
1
똑같은 기능을 하는 테이블
0
447
4
관계형
0
312
2
프론트 서버를 이용하지 않는경우
1
299
3
인피니트 스크롤링 사용시 오류
0
278
0
계속 이런에러가 떠서 해결하기는 했는데 어떤 의미인지 모르겠습니다.
0
433
2
req.user가 언제 생성되나요??
0
330
2
Cannot read property 'id' of null 에러
0
333
1
리트윗한 게시글 불러오는 sequelize
0
252
1
result.data에서 images인 이유
0
281
2
takeLatest에 대한 질문입니다.
1
342
2
프론트에서 express를 사용하지 않을때 동적라우팅
0
501
6
getInitialProps가 클라이언트에서 수행되는 이유?
0
258
1
리로드하면 팔로우 언팔로우 값이 초기화 되는 문제입니다.
0
445
2
스타일드 컴포넌트와 className을 통한 스타일 적용의 차이에 대해 궁금합니다
0
585
2
할인 쿠폰 사용이 안되는되요 (848-f9af83f183e3)
0
365
1
nodejs mvc 패턴
0
975
4
사용하고 보니, 람다 구성이 궁금합니다!
0
266
1
제로초님
0
445
1
새로고침 로그인 풀림 문제.
0
247
1
안녕하세요. 강의 너무 감사합니다
0
157
1
제로초님
0
170
1





