CommonJS
๊ฐ์ ธ์ค๊ธฐ
require('๋ชจ๋์๊ฒฝ๋ก')
๋ด๋ณด๋ด๊ธฐ [ํฌ๊ฒ ๋ชจ๋ ๊ฐ์ฒด ์ฌ์ฉํ๊ฑฐ๋, exportsํค์๋ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ]
module.exports = {...} module.exports = ๊ฐ module.exports.key_name = value exports.key_name = value
CommonJS๋ ๊ธฐ๋ณธ์ ์ผ๋ก ์ ์ญ์์ module์ด๋ผ๋ ํค์๋๋ฅผ ์ ๊ณตํ๊ณ ์๋ค.
NodeJS์์ ์ฑํํ CommonJS, ๋ฐ๋ผ์ ๊ฒฝ๋ก์ง์ ์, .js ๋ฅผ ์ ์ธํ๊ณ ์์ฑํด๋ ์๋๋๋ค.
Last updated
Was this helpful?