일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- 루비
- 장고
- 웹프로그래밍
- Ruby On Rails
- jquery
- node.js
- css3
- 꿀팁
- nodejs
- 홈페이지 개발하기
- 파이썬 웹 프레임워크
- 데스크탑애플리케이션
- Django
- 장고 공부하기
- nodejs api
- 레일즈
- express-mysql-session
- rails
- 예스인테리어
- Python
- 루비온레일즈
- 프론트엔드
- django 공부하기
- 웹 프로그래밍 입문
- 웹 프로그래밍
- 루비 온 레일즈
- 웹 프론트엔드
- 모듈화
- 모닝버드
- rails review
- Today
- Total
노래하듯 이야기하고, 춤추듯 정복하라.
[Electron] electron 5.0 이상부터 require is not defined 에러가 발생하는 이유 본문
[Electron] electron 5.0 이상부터 require is not defined 에러가 발생하는 이유
hyeoke 2019. 10. 4. 17:37#오류내용
새 electron 프로젝트를 생성한 후, front-end 단 (.hmlt 파일) 안의 script 코드에서 require()을 사용하면 require is not defined 오류가 발생한다.
#이유
electron 5.0 이상부터 new BrowserWindow 객체를 생성할 때, nodeIntegeration의 기본값이 false로 세팅되어 있기 때문이다.
#해결법
아래 5번째 줄 코드와 같이 webPrefereces 안의 nodeIntegration 설정값을 true로 바꿔준다.
addWindow = new BrowserWindow({
width: 300,
height: 200,
title: 'Add Shopping List Item',
webPreferences: { nodeIntegration: true } // true로 설정
});
아래 화면과 같이 require is not defined 에러가 사라진 것을 볼 수 있다.
#참고링크
- https://porinn.tistory.com/56
electron 5.0.0에서 require is not defined 에러가 발생하는 경우
새 electron 프로젝트를 개발하는데 ipcRenderer를 정의할 때 require is not defined 에러가 발생했다. 과거 프로젝트는 동일 코드에서 정상 동작하는데 새 프로젝트에서만 에러가 발생해서 확인해보니까 electro..
porinn.tistory.com
electron 5.0.0 "Uncaught ReferenceError: require is not defined"
I had initially been using electron stable (4.x.x), and was able to use require in both my browser and renderer processes. I upgraded to electron beta (5.0.0) because I needed a newer version of no...
stackoverflow.com