Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 코틀린
- 시플플은영원하구나
- 자바스크립트
- 야근은결국승리
- HTML 자바스크립트 태그제거
- 모던디자인테마
- 편하게쓰자
- 신기술은
- checkupdates
- VSCode
- 리엑트
- 안할수가없네
- kotlinc
- 리엑트라우터 구버전 살리기
- ReactRouter withRouter
- 무과금살아남기
- 해볼게
- 나의야근
- 정규식
- 선택했을까
- 날이새도록
- react
- 복붙하기좋은
- ReactRouter 4
- ubuntu_rg_cpu_100%
- ReactRouter6 다운그레이드
- ERR_CERT_AUTHORITY_INVALID
- 반갑지는않아
- vscode 수동업데이트
- 공부할시간이
Archives
- Today
- Total
필사(筆寫)
Node.vm 으로 하위 가상 모듈 만들기 사용법 메모 본문
https://nodejs.org/api/vm.html
VM (executing JavaScript) | Node.js v22.5.0 Documentation
VM (executing JavaScript)# Source Code: lib/vm.js The node:vm module enables compiling and running code within V8 Virtual Machine contexts. The node:vm module is not a security mechanism. Do not use it to run untrusted code. JavaScript code can be compiled
nodejs.org
가끔 코어단 설계시 사용하는 vm 설계 구문 메모해두기
engine.vm = async () => {
// const script = new vm.Script(bundle, { filename: 'bundle.js' })
// const sandbox = { require, module: {}, process, __dirname: path.dirname(entry), console }
// const context = vm.createContext(sandbox)
// script.runInContext(context)
// return sandbox.module.exports.default;
}
cjs 때는 위와 같은 context 를 수반하고, esm는 import 구문을 주로 사용한다.
'Service Developments > Node.js,Express' 카테고리의 다른 글
Nodejs ESM 모듈 동적 import 구문 몇가지 예시 (0) | 2024.07.19 |
---|---|
nginx 1.27.1 http3 설정 방법 및 체크 방법 (0) | 2024.07.19 |
ubunutu 20, 22 계열 기본 설치된 nginx 1.18 삭제 방법 (0) | 2024.07.19 |
express.js "uv_resident_set_memory" 오류 (0) | 2024.07.19 |
V8에서 GC를 조금 더 빠르게 쓰는 가장 간단한 팁 (0) | 2024.01.28 |