{"id":13532,"date":"2023-03-30T17:16:34","date_gmt":"2023-03-30T08:16:34","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=13532"},"modified":"2023-03-29T17:21:58","modified_gmt":"2023-03-29T08:21:58","slug":"%ed%94%84%eb%a1%a0%ed%8a%b8%ec%97%94%eb%93%9c-%ec%9b%b9-%ed%8e%98%ec%9d%b4%ec%a7%80-javascript-%ea%b0%9c%eb%b0%9c-%ed%99%98%ea%b2%bd-%eb%a7%8c%eb%93%a4%ea%b8%b0","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=13532","title":{"rendered":"\ud504\ub860\ud2b8\uc5d4\ub4dc \uc6f9 \ud398\uc774\uc9c0 JavaScript \uac1c\ubc1c \ud658\uacbd \ub9cc\ub4e4\uae30"},"content":{"rendered":"<h2>\uae30\ubcf8 \uc124\uc815<\/h2>\n<h4># Node.js \uc124\uce58<\/h4>\n<p>npm \uba85\ub839 \uc2e4\ud589\uc744 \uc704\ud568<\/p>\n<h4># <code>npm init -y<\/code><\/h4>\n<p>npm init\ub294 package.json\uc744 \ub9cc\ub4e4\uae30 \uc704\ud55c \uba85\ub839\uc774\uace0 -y\ub97c \ubd99\uc784\uc73c\ub85c\uc368 \ubcc4\ub3c4\uc758 \uc785\ub825 \uc5c6\uc774 \uae30\ubcf8 \uac12\uc73c\ub85c \uc9c4\ud589 \uc2dc\ud0b4. package.json\uc740 \uc791\uc131\ud558\uace0\uc790 \ud558\ub294 \ud504\ub85c\uc81d\ud2b8\uc5d0 \ub300\ud55c \uc124\uc815 \ud30c\uc77c\ub85c \ubcfc \uc218 \uc788\uc73c\uba70, \ud504\ub85c\uc81d\ud2b8 \uc774\ub984\uacfc \ubc84\uc804 \ub4f1\uacfc \uac19\uc740 \uc124\uba85\uacfc \ud504\ub85c\uc81d\ud2b8\uac00 \uc0ac\uc6a9\ud558\ub294 \ub77c\uc774\ube0c\ub7ec\ub9ac\uc5d0 \ub300\ud55c \uc815\ubcf4 \uadf8\ub9ac\uace0 \ud504\ub85c\uc81d\ud2b8 \uc2e4\ud589 \ub4f1\uc744 \uc704\ud55c \uba85\ub839\uc5d0 \ub300\ud55c \uc815\ubcf4\uac00 \ub2f4\uaca8\uc788\uc74c. package.json \ud30c\uc77c\uc740 npm\uc744 \uc704\ud55c \ud30c\uc77c\uc784(VS.Code\ub97c \uc704\ud55c \uac83\uc774 \uc544\ub2d8)<\/p>\n<h4># <code>npm install webpack webpack-cli --save-dev<\/code><\/h4>\n<h4># webpack.config.js \ud30c\uc77c \uc0dd\uc131 \ubc0f \ub0b4\uc6a9 \uc791\uc131<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\">\r\nconst path = require(\"path\");\r\nmodule.exports = {\r\n    mode: \"development\",\r\n    entry: \".\/src\/index.js\",\r\n    devtool: \"inline-source-map\",\r\n    module: {\r\n        rules: [],\r\n    },\r\n    resolve: {\r\n        extensions: [\".js\"],\r\n    },\r\n    output: {\r\n        filename: \"bundle.js\",\r\n        path: path.resolve(__dirname, \"dist\"),\r\n    },\r\n}\r\n<\/pre>\n<h4># src, dist \ud3f4\ub354 \ubc0f index.html(dist \ud3f4\ub354), index.js(src \ud3f4\ub354) \ud30c\uc77c \uc0dd\uc131<\/h4>\n<h4># index.html \ucf54\ub4dc \uc785\ub825<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">\r\n...\r\n\r\n&lt;script src=\"bundle.js\">&lt;\/script> \r\n\r\n...\r\n<\/pre>\n<h4># index.js \ucf54\ub4dc \uc785\ub825<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">\r\nconsole.log(\"Hello\");\r\n<\/pre>\n<h4># package.json \ud30c\uc77c\uc758 &#8220;scripts&#8221; \ud30c\ud2b8\uc5d0 &#8220;bundle&#8221;: &#8220;webpack&#8221; \uc785\ub825<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\">\r\n{\r\n  ..\r\n  \"scripts\": {\r\n    ..\r\n    \"bundle\": \"webpack\"\r\n  },\r\n  ..\r\n}\r\n<\/pre>\n<h4># <code>npm run bundle<\/code> \uc2e4\ud589<\/h4>\n<p>Typescript\ub85c \uc791\uc131\ub41c \ud30c\uc77c\uc744 Javascript \ud30c\uc77c\ub85c \ud2b8\ub79c\uc2a4\ud30c\uc77c\ub9c1 \uc2dc\ud0b4<\/p>\n<h2>\uc790\ub3d9 \uc2e4\ud589\uc744 \uc704\ud55c \uc124\uc815<\/h2>\n<h4># package.json \ud30c\uc77c\uc758 &#8220;scripts&#8221; \ud30c\ud2b8\uc5d0 &#8220;watch&#8221;: &#8220;webpack &#8211;watch&#8221; \ubc0f &#8220;start&#8221;: &#8220;npm run bundle &#038;&#038; npm run watch&#8221; \ucd94\uac00<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\">\r\n{\r\n  ..\r\n  \"scripts\": {\r\n    ..\r\n    \"bundle\": \"webpack\",\r\n    \"watch\": \"webpack --watch\",\r\n    \"start\": \"npm run bundle && npm run watch\"\r\n  },\r\n  ..\r\n}\r\n<\/pre>\n<h4># VS.Code\uc5d0\uc11c Live Server \ud655\uc7a5 \uae30\ub2a5 \uc124\uce58<\/h4>\n<h4># <code>npm run start<\/code> \uc2e4\ud589<\/h4>\n<p>\uc774\uc81c\ubd80\ud130 \ubaa8\ub4e0 Javascript \uc18c\uc2a4 \ucf54\ub4dc\ub4e4\uc744 \uc790\ub3d9\uc73c\ub85c bundle.js \ud30c\uc77c \ud558\ub098\ub85c \ubb36\uc5b4\uc90c<\/p>\n<h4># index.html \uc5f4\uace0 GO LIVE \ud65c\uc131\ud654<\/h4>\n","protected":false},"excerpt":{"rendered":"<p>\uae30\ubcf8 \uc124\uc815 # Node.js \uc124\uce58 npm \uba85\ub839 \uc2e4\ud589\uc744 \uc704\ud568 # npm init -y npm init\ub294 package.json\uc744 \ub9cc\ub4e4\uae30 \uc704\ud55c \uba85\ub839\uc774\uace0 -y\ub97c \ubd99\uc784\uc73c\ub85c\uc368 \ubcc4\ub3c4\uc758 \uc785\ub825 \uc5c6\uc774 \uae30\ubcf8 \uac12\uc73c\ub85c \uc9c4\ud589 \uc2dc\ud0b4. package.json\uc740 \uc791\uc131\ud558\uace0\uc790 \ud558\ub294 \ud504\ub85c\uc81d\ud2b8\uc5d0 \ub300\ud55c \uc124\uc815 \ud30c\uc77c\ub85c \ubcfc \uc218 \uc788\uc73c\uba70, \ud504\ub85c\uc81d\ud2b8 \uc774\ub984\uacfc \ubc84\uc804 \ub4f1\uacfc \uac19\uc740 \uc124\uba85\uacfc \ud504\ub85c\uc81d\ud2b8\uac00 \uc0ac\uc6a9\ud558\ub294 \ub77c\uc774\ube0c\ub7ec\ub9ac\uc5d0 \ub300\ud55c \uc815\ubcf4 \uadf8\ub9ac\uace0 \ud504\ub85c\uc81d\ud2b8 \uc2e4\ud589 \ub4f1\uc744 \uc704\ud55c \uba85\ub839\uc5d0 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=13532\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;\ud504\ub860\ud2b8\uc5d4\ub4dc \uc6f9 \ud398\uc774\uc9c0 JavaScript \uac1c\ubc1c \ud658\uacbd \ub9cc\ub4e4\uae30&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88],"tags":[],"class_list":["post-13532","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/13532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13532"}],"version-history":[{"count":4,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/13532\/revisions"}],"predecessor-version":[{"id":13536,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/13532\/revisions\/13536"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13532"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}