<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ESM on 技術浮浪貢</title><link>https://blog.plk.tw/tags/esm/</link><description>Recent content in ESM on 技術浮浪貢</description><generator>Hugo</generator><language>zh-tw</language><lastBuildDate>Wed, 23 Aug 2023 02:07:26 +0800</lastBuildDate><atom:link href="https://blog.plk.tw/tags/esm/index.xml" rel="self" type="application/rss+xml"/><item><title>在 CommonJS module 中使用 ESM 型別</title><link>https://blog.plk.tw/posts/2023/08/import-esm-types-to-commonjs-module/</link><pubDate>Wed, 23 Aug 2023 02:07:26 +0800</pubDate><guid>https://blog.plk.tw/posts/2023/08/import-esm-types-to-commonjs-module/</guid><description>&lt;p&gt;要在 CommonJS module 中使用 ESM 必須透過&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import"&gt;動態 import&lt;/a&gt;；但型別是編譯時期的資訊，一定要用靜態 import。透過&lt;em&gt;宣告檔案&lt;/em&gt;（Declaration File）可以解決這個問題。&lt;/p&gt;</description></item></channel></rss>