Skip to the content Skip to the main menu

Time is Life!

Make your life fun and creative!!

  • Sitemap
A freelance web engineer. A dad for two kids :)
Be simple and practical!
  • Getting Started with Anchor Positioning
    2026-07-06
  • CSS vs. JavaScript
    2026-05-26
  • Scroll-Driven Animations
    2026-04-28
  • Squash and Stretch
    2026-04-13
  • Sneaky Header Blocker Trick
    2026-03-23
  • Sprites on the Web
    2026-02-23
  • Brand New Layouts with CSS Subgrid
    2025-11-25
  • Springs and Bounces in Native CSS
    2025-10-28
  • The Big Gotcha With @starting-style
    2025-09-22
  • Color Shifting in CSS
    2025-09-08

RSS Cointelegraph

  • VanEck criticizes Metaplanet over executive dilution despite compensation cuts 2026-09-19
  • Bastion wins conditional OCC approval for national trust bank charter 2026-09-19
  • Hong Kong jails former banker over $1.6B false credit, cryptocurrency bribes: Report 2026-09-19
  • Here’s what happened in crypto today 2026-09-18
  • Coinbase files to bring single-stock perpetual futures to US market 2026-09-18

RSS CoinPost

  • WiFi共有のDePin系プロジェクト「Roam」、ソラナブロックチェーンに移行 2024-04-01
  • イーサリアムの分散化促進などを期待 ヴィタリック、開発計画「パージ」を説明 2024-04-01
  • Farcaster開発企業、パラダイム主導のラウンドで「ユニコーン」に 2024-04-01
  • コインベースがArkham新規上場、廃止銘柄も 2024-04-01
  • テザー社、ビットコイン保有が7800億円超え 2024-04-01

RSS CSS-Tricks

  • Let’s Use the Emergent CSS random() Function in all the Browsers 2026-08-31
  • What’s !important #18: <geolocation>, Syntax ::highlight()ing, named-feature(), and More 2026-08-31
  • Creating Web Widgets Using the Document Picture-in-Picture API 2026-08-27
  • animation-trigger 2026-08-26
  • MicroLighter: Syntax Highlighter 2026-08-25

RSS Coliss

  • クリスタの最新機能もこれでよく分かる! プロ絵師たちが使用するイラスト制作のテクニックを徹底的に解説 -クリスタ操作術 決定版 改訂2版 2026-09-18
  • 浮世絵にインスパイアされたUIコンポーネント、和紙・墨・朱の和のカラースキームが癒やされる -Hinomaru Ink UI Kit 2026-09-17
  • これはUIデザイナーの手間が増えそう! iPhone DuoでWebページがどのように表示されるかを確認できるシミュレータ -iPhone Duo Simulator 2026-09-15
  • HTMLのcamera要素、CSSで最上行と最上列を固定表示した表を実装できるなど、Chrome 153で追加された新機能 2026-09-15
  • こういうデザイン書が欲しかった! 不易流行、日本の伝統デザインについて深くふかく学べるデザイン書 -伝統デザインのはなし 2026-09-11

カテゴリー

  • AWS (4)
  • CircleCI (1)
  • CSS (2)
  • Docker (2)
  • GCP (2)
  • GraphQL (2)
  • i18n (2)
  • JavaScript (15)
  • Next.js (4)
  • Node.js (1)
  • Nuxt.js (10)
  • React (10)
  • Sass (2)
  • Storybook (1)
  • tailwindcss (1)
  • TypeScript (18)
  • Web Tech (2)
  • 転職 (2)

Make your life fun and creative!!

  • Sitemap
A freelance web engineer. A dad for two kids :)
Be simple and practical!
  • Getting Started with Anchor Positioning
    2026-07-06
  • CSS vs. JavaScript
    2026-05-26
  • Scroll-Driven Animations
    2026-04-28
  • Squash and Stretch
    2026-04-13
  • Sneaky Header Blocker Trick
    2026-03-23
  • Sprites on the Web
    2026-02-23
  • Brand New Layouts with CSS Subgrid
    2025-11-25
  • Springs and Bounces in Native CSS
    2025-10-28
  • The Big Gotcha With @starting-style
    2025-09-22
  • Color Shifting in CSS
    2025-09-08

RSS Cointelegraph

  • VanEck criticizes Metaplanet over executive dilution despite compensation cuts 2026-09-19
  • Bastion wins conditional OCC approval for national trust bank charter 2026-09-19
  • Hong Kong jails former banker over $1.6B false credit, cryptocurrency bribes: Report 2026-09-19
  • Here’s what happened in crypto today 2026-09-18
  • Coinbase files to bring single-stock perpetual futures to US market 2026-09-18

RSS CoinPost

  • WiFi共有のDePin系プロジェクト「Roam」、ソラナブロックチェーンに移行 2024-04-01
  • イーサリアムの分散化促進などを期待 ヴィタリック、開発計画「パージ」を説明 2024-04-01
  • Farcaster開発企業、パラダイム主導のラウンドで「ユニコーン」に 2024-04-01
  • コインベースがArkham新規上場、廃止銘柄も 2024-04-01
  • テザー社、ビットコイン保有が7800億円超え 2024-04-01

RSS CSS-Tricks

  • Let’s Use the Emergent CSS random() Function in all the Browsers 2026-08-31
  • What’s !important #18: <geolocation>, Syntax ::highlight()ing, named-feature(), and More 2026-08-31
  • Creating Web Widgets Using the Document Picture-in-Picture API 2026-08-27
  • animation-trigger 2026-08-26
  • MicroLighter: Syntax Highlighter 2026-08-25

RSS Coliss

  • クリスタの最新機能もこれでよく分かる! プロ絵師たちが使用するイラスト制作のテクニックを徹底的に解説 -クリスタ操作術 決定版 改訂2版 2026-09-18
  • 浮世絵にインスパイアされたUIコンポーネント、和紙・墨・朱の和のカラースキームが癒やされる -Hinomaru Ink UI Kit 2026-09-17
  • これはUIデザイナーの手間が増えそう! iPhone DuoでWebページがどのように表示されるかを確認できるシミュレータ -iPhone Duo Simulator 2026-09-15
  • HTMLのcamera要素、CSSで最上行と最上列を固定表示した表を実装できるなど、Chrome 153で追加された新機能 2026-09-15
  • こういうデザイン書が欲しかった! 不易流行、日本の伝統デザインについて深くふかく学べるデザイン書 -伝統デザインのはなし 2026-09-11

カテゴリー

  • AWS (4)
  • CircleCI (1)
  • CSS (2)
  • Docker (2)
  • GCP (2)
  • GraphQL (2)
  • i18n (2)
  • JavaScript (15)
  • Next.js (4)
  • Node.js (1)
  • Nuxt.js (10)
  • React (10)
  • Sass (2)
  • Storybook (1)
  • tailwindcss (1)
  • TypeScript (18)
  • Web Tech (2)
  • 転職 (2)

Using package.json as a module in TypeScript

If you want to get a value like the version info from package.json, this is what to do.

Add resolveJsonModule config to tsconfig.json.

{
  "compilerOptions": {
    "target": "es5",
    ...
    "resolveJsonModule": true
  }
}

Import package.json in your ts file.

import { version } from 'package.json';
  • Post date
    2021-03-31
  • Posted in JavaScript, TypeScript
Previous post: Next.js with PostCSS 100vh Fix Next post: How to seed data into Mongo with Docker

Related Posts

AWS AmplifyでReactアプリケーション (TypeScript & GraphQL)

  • Posted in AWS, GraphQL, React, TypeScript

AWS Amplify: Auth関連まとめ

  • Posted in AWS, GraphQL, React, TypeScript

React: IntersectionObserver hook (TypeScript)

  • Posted in JavaScript, React, TypeScript

Level Up Your Next.js App: How to Use Prisma

  • Posted in Next.js, TypeScript

Follow me on Twitter.