๋ค์์ ๋ชจ๋์ ๋ช ์ ์ ์ผ๋ก ๋ด๋ณด๋ด๋ ์์ ์ธ๋ถ ๋ชจ๋์ ๋๋ค.
module Foo {
export var foo = 42;
}
export = Foo;
์ด๋ฅผ ์ํด ์์ฑ ๋ ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
define(["require", "exports"], function(require, exports) {
var Foo;
(function (Foo) {
Foo.foo = 42;
})(Foo || (Foo = {}));
return Foo;
});
"๋ด๋ณด๋ด๊ธฐ"๋งค์ง ์ข ์์ฑ์ด ํ์ํ์ง๋ง์ด๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ๋์ Foo๋ฅผ ์ง์ ๋ฐํํ๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ๋์ AMD์ฒ๋ผ ๋๊ปด์ง๋๋ค.
์ต์ํ์ AMD ๋ก๋์๊ฒ๋ ๋ชจ๋์ ๊ฐ์ฒด ๋ฐํ์ด "๋ด๋ณด๋ด๊ธฐ"๊ฐ์ฒด๋ผ๊ณ ๊ฐ์ ํ ์์๊ณ ์์ฒญํ "๋ด๋ณด๋ด๊ธฐ"๊ฐ์ฒด๋ฅผ ๋ฎ์ด ์ฐ๋ ๋ฌด์ธ๊ฐ๋ฅผ ๋ฐํํด์ผํ๋ค๊ณ ์ถ์ธกํด์ผํ๊ธฐ ๋๋ฌธ์ ์ฑ๊ฐ์ ์ผ์ ๋๋ค.
๋ํ ์ฌ์ฉ๋์ง ์์ ๋ 'require'์ ๋ํ ์ข ์์ฑ์ ์ ์ธํ๋ ์ด์ ๋ ๋ฌด์์ ๋๊น?
ํฉ๋ฆฌ์ ์ธ ์ ์ ๊ฐ์
์น์ธ ๋จ
๊ทธ๋์ ๋ด๊ฐ ์ด๊ฒ์ ๋ํด ๋ฌผ์ ์ง๋ฌธ : https://stackoverflow.com/questions/44836084/omit-require-and-exports-from-typescript-emitted-amd-dependencies
์์ง ๊ตฌํ๋์ง ์์์ต๋๊น? ํ์ ํด์ ...
@amandaol ๋ฌธ์ ์ ํ๊ทธ๋ ๊ตฌํํ๋ ๊ฒ์ด ์ปค๋ฎค๋ํฐ์ ๋ฌ๋ ค ์์์ ๋ํ๋ ๋๋ค. ์ฌ์ ํ ์ด๋ ค์๋ ๋ฌธ์ ์ ๊ฒฐํฉ๋๋ฉด ํด๋น ๋ฌธ์ ๊ฐ ๊ตฌํ๋์ง ์์์ต๋๋ค.
๊ทธ ๊ฐ์น๋ฅผ ์ํด ์ด์ tsc
์ดํ ๋น๋ ํ์ดํ ๋ผ์ธ์์ amdextract
ํ์ฌ ์์ฑ ๋ JS์์ ๋ถํ์ํ require
๋ฐ exports
์ ๊ฑฐํฉ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๊ทธ๋์ ๋ด๊ฐ ์ด๊ฒ์ ๋ํด ๋ฌผ์ ์ง๋ฌธ : https://stackoverflow.com/questions/44836084/omit-require-and-exports-from-typescript-emitted-amd-dependencies