Skip to content
ℕ𝔸𝕊𝔸™ℕ𝕒𝕤𝕒𝕣𝕖™𝕊𝕡𝕒𝕔𝕖𝕏™ https://nasa.re/

Nasare™🚀

フレッシュ スペース & テクノロジー NEWS📢

  • About 𝒩𝒶𝓈𝒶𝓇𝑒™
  • SMART Tools
  • SMART AI
    • Kubeshark PCAP Export/Import
    • Coaching engineering managers to employ on organizational issues
    • Zelda: Hyperlink’s Awakening game engine documentation (2021)
    • Commercial Resupply Services-CRS
  • Show HN
    • WINd3x、iPod Bootrom エクスプロイトは 10 年遅かった
    • Just by Notでプログラミングするシステム オブジェクト指向プログラミングの活用
    • 主な BGP 増加をレジデンス Windows デスクトップに追加する
    • ガジェットの複雑さが増し、余分な IP の再利用が促進される
    • 新しい GitHub CLI 拡張インストゥルメント
    • Kubernetes を 7,500 ノードにスケーリング (2021 年)
    • Wander アプリ用の軽量なオンザフリット構成ライブラリ
    • Ask HN
      • Declare HN: I wrote a WebAssembly Interpreter and Toolkit in C
      • Describe HN: Kandria, an action RPG made in Frequent Voice, is now out
      • Demonstrate HN: ClickHouse-local – a runt instrument for serverless files analytics
      • Brand HN: Motion photographs Watchlist Chrome Extension
      • Existing HN: Connmap – Desktop widget that reveals your TCP company on an international diagram
      • Level to HN: An initiate source tool to generate Jet Engine compressors
      • Insist HN: Ov – characteristic smartly off terminal pager
      • Level to HN: Graphic-Walker – A special kind of originate-offer different to Tableau
      • Level to HN: A corpulent game of snake encoded in a url
      • Point out HN: Kweb: A a ways away interface to the earn browser’s DOM
      • Present HN: Nanelo DNS – Privacy-Kindly, European Nameservers
      • Reward HN: Vim on-line editor the exercise of WebAssembly, storing files the exercise of IndexedDB
      • Show HN: AREnets – TensorFlow-basically based mostly Relation Extraction equipment for work in Colab
      • Speak HN: What sub $200 product improved HN readers’ 2022
      • Uncover HN: Easy internet app for teenagers to management a single Philips Hue light
      • Advise HN: Daft Art – an album veil maker powered by AI and curated aesthetics
    • Show HN
      • Reward HN: Vim on-line editor the exercise of WebAssembly, storing files the exercise of IndexedDB
      • Android phones will at the moment obtain iPhone-love SOS satellite texting
      • Demonstrate HN: ClickHouse-local – a runt instrument for serverless files analytics
      • Show HN: AREnets – TensorFlow-basically based mostly Relation Extraction equipment for work in Colab
      • Present HN: Nanelo DNS – Privacy-Kindly, European Nameservers
      • Insist HN: Ov – characteristic smartly off terminal pager
      • Level to HN: An initiate source tool to generate Jet Engine compressors
      • Speak HN: What sub $200 product improved HN readers’ 2022
      • Advise HN: Daft Art – an album veil maker powered by AI and curated aesthetics
      • Uncover HN: Easy internet app for teenagers to management a single Philips Hue light
      • Level to HN: A corpulent game of snake encoded in a url
    • Brand HN: Motion photographs Watchlist Chrome Extension
    • Existing HN: Connmap – Desktop widget that reveals your TCP company on an international diagram
    • Point out HN: Kweb: A a ways away interface to the earn browser’s DOM
    • Declare HN: I wrote a WebAssembly Interpreter and Toolkit in C
    • Tag HN: Using Key-Value Retail outlets in Serverless Codehooks.io Applications
    • Declare HN: I wrote a WebAssembly Interpreter and Toolkit in C
    • Point out HN: Kweb: A a ways away interface to the earn browser’s DOM
    • Existing HN: Connmap – Desktop widget that reveals your TCP company on an international diagram
    • Brand HN: Motion photographs Watchlist Chrome Extension
    • Level to HN: A corpulent game of snake encoded in a url
    • Uncover HN: Easy internet app for teenagers to management a single Philips Hue light
    • Advise HN: Daft Art – an album veil maker powered by AI and curated aesthetics
    • Speak HN: What sub $200 product improved HN readers’ 2022
    • Level to HN: An initiate source tool to generate Jet Engine compressors
    • Level to HN: Graphic-Walker – A special kind of originate-offer different to Tableau
    • Insist HN: Ov – characteristic smartly off terminal pager
    • Present HN: Nanelo DNS – Privacy-Kindly, European Nameservers
    • Show HN: AREnets – TensorFlow-basically based mostly Relation Extraction equipment for work in Colab
    • Demonstrate HN: ClickHouse-local – a runt instrument for serverless files analytics
    • Reward HN: Vim on-line editor the exercise of WebAssembly, storing files the exercise of IndexedDB
  • A Computer virus and a Dilemma
    • OCIS – OwnCloud Countless Scale
    • A Princeton student built an app which is ready to detect if ChatGPT wrote an essay
    • GitHub Is Sued, and We Would possibly perhaps Learn Something About Creative Commons Licensing
    • Adobe’s Command material analysis can be using photos/videos to narrate AI w/o consent
    • Ultralearning a.k.a. how I learned to code
    • Automatic1111 is assist on GitHub after taking away Embedding Links
    • Where Your Sides Came From
    • What Is a Pig Butchering Rip-off?
    • Submit-processing is ruining iPhone photos
    • Clos Topologies and Centralized Retain a watch on in Google’s Datacenter Community
    • Miller Engineering DS-1 House Planetarium
    • Gimel Studio: Non-harmful, 2D image editor
  • Technology
    • Miller Engineering DS-1 House Planetarium
    • Apple Doctors: to construct it as a file it is advisable to electronic mail it to your self
    • The Air India passenger who urinated on a girl has been fired by Wells Fargo
    • The Filesystem Hierarchy Usual Comes to Guix Containers
    • Sooner than it sued Google for copying from Java, Oracle changed into as soon as copying IBM’s SQL (2020)
    • The i3-gaps mission has been merged with i3
    • Making an Alphorn from Scratch
    • Apple: Braille Individual Guides
    • MotherDuck Is a Original Thought
    • The class of CGI and simple make
    • Like a mercurial tour of DragonFly BSD 6.4?
    • computer science
    • AI
    • Artificial intelligence
    • Technology
    • Ai
    • Apple
    • digital
  • TOP HN
    • anti-Mastodon
    • TOP HN
      • Show HN
      • Ask HN
      • coding
      • ガジェットの複雑さが増し、余分な IP の再利用が促進される
      • 新しい GitHub CLI 拡張インストゥルメント
      • Kubernetes を 7,500 ノードにスケーリング (2021 年)
      • Just by Notでプログラミングするシステム オブジェクト指向プログラミングの活用
      • Describe HN: Kandria, an action RPG made in Frequent Voice, is now out
      • WINd3x、iPod Bootrom エクスプロイトは 10 年遅かった
      • Wander アプリ用の軽量なオンザフリット構成ライブラリ
      • Artificial intelligence
      • 主な BGP 増加をレジデンス Windows デスクトップに追加する
      • Technology
      • Level to HN: Graphic-Walker – A special kind of originate-offer different to Tableau
      • Declare HN: I wrote a WebAssembly Interpreter and Toolkit in C
      • Point out HN: Kweb: A a ways away interface to the earn browser’s DOM
      • Existing HN: Connmap – Desktop widget that reveals your TCP company on an international diagram
      • Advise HN: Daft Art – an album veil maker powered by AI and curated aesthetics
      • Brand HN: Motion photographs Watchlist Chrome Extension
      • Declare HN: I wrote a WebAssembly Interpreter and Toolkit in C
      • Demonstrate HN: ClickHouse-local – a runt instrument for serverless files analytics
      • Describe HN: Kandria, an action RPG made in Frequent Voice, is now out
      • Existing HN: Connmap – Desktop widget that reveals your TCP company on an international diagram
      • Insist HN: Ov – characteristic smartly off terminal pager
      • Just by Notでプログラミングするシステム オブジェクト指向プログラミングの活用
      • Kubernetes を 7,500 ノードにスケーリング (2021 年)
      • Level to HN: A corpulent game of snake encoded in a url
      • Level to HN: An initiate source tool to generate Jet Engine compressors
      • Level to HN: Graphic-Walker – A special kind of originate-offer different to Tableau
      • Point out HN: Kweb: A a ways away interface to the earn browser’s DOM
      • Present HN: Nanelo DNS – Privacy-Kindly, European Nameservers
      • Reward HN: Vim on-line editor the exercise of WebAssembly, storing files the exercise of IndexedDB
      • Show HN: AREnets – TensorFlow-basically based mostly Relation Extraction equipment for work in Colab
      • Speak HN: What sub $200 product improved HN readers’ 2022
      • Uncover HN: Easy internet app for teenagers to management a single Philips Hue light
      • Wander アプリ用の軽量なオンザフリット構成ライブラリ
      • WINd3x、iPod Bootrom エクスプロイトは 10 年遅かった
      • ガジェットの複雑さが増し、余分な IP の再利用が促進される
      • 主な BGP 増加をレジデンス Windows デスクトップに追加する
      • 新しい GitHub CLI 拡張インストゥルメント
      • ロンドンで*ダウン*を継続的に見つめる: Pavement Oddities
      • 報酬 HN: C の 30 行でスピンロック
      • FAA の NOTAM とは何ですか? 航空専門家が機械の仕組みを説明
      • ナノGPT
      • 1 ビット LCD のグレースケール (2022)
      • The Muse (YC W12) は FP&A のシニア ディレクターを採用しています
      • Zen (YC S21) はグロース エンジニアを採用しています
      • Tall Inquire of (YC W21) が B2B 回顧録の幹部を採用
      • Actiondesk (YC S19) は、プロダクト ドレスメーカーを採用しています (4-6 か月の契約)
      • Oven (YC S19) は、Bun を作成するために C/C++ または Zig エンジニアを採用しています。
      • WInd3x, the iPod Bootrom exploit 10 years too unhurried
      • Sign HN: FASTA recordsdata を操作するための FUSE モジュール
      • HN を指します: Socketify.py: PyPy3 および Python3 用の Http/Https および WebSocket サーバー
      • Wage Development Continues to Gradual in the UK and Euro House
      • Stage Supervisor for the unimpressed: 1 Getting started
      • First public free up of Pushup: a brand unique compiler for making net apps in Trip
      • Fixing Cart-Pole Swingup with a Hierarchical Controller
      • Flight Testing the Touchdown Radar for Mars Science Laboratory 2011-06-21T17:36:36Z
      • Flightcontrol (YC W22) is hiring first Developer Recommend
      • Flying boats and other tech for cleaner shipping
      • Four Finalist Touchdown Location Candidates for Mars Science Laboratory 2008-11-19T16:21:01Z
      • France’s prized nuclear sector stalled in Europe’s hour of want
      • French startup unveils new residential thermo-acoustic warmth pump
      • FTC Cracks Down on Firms That Impose Contaminated Noncompete Restrictions
      • FTX’s Aged Prime Lawyer Aided US Authorities in Bankman-Fried Case
      • FY18 NASA lėšų šnypštimas 2017-05-22T00:00:00Z
      • G-3PO: A protocol droid for Ghidra, or GPT-3 for reverse-engineering
      • Gail.com FAQ
      • Gemini-Titan (GT)-6 – Gemini 6 of 7 – 지역 사진 – 외부 지역 1965-12-15T00:00:00Z
      • Geoffrey Hinton Publishes Original Deep Learning Algorithm
      • Germany warns: AI fingers flee already underway (2021)
      • Gimel Studio: Non-harmful, 2D image editor
      • GitHub Availability File
      • GitHub Is Sued, and We Would possibly perhaps Learn Something About Creative Commons Licensing
      • Google needs RISC-V to be a “tier-1” Android architecture
      • Google researcher, lengthy out of math, cracks devilish dispute about gadgets
      • Google start sourced CDC File Transfer from the ashes of Stadia
      • GRC-2003-C-02097 2004-05-01T00:00:00Z
      • GRC-2013-C-05246 2009-11-26T00:00:00Z
      • Hello world!
      • Highlights of Science Launching on SpaceX CRS-15 2018-06-24T00:00:00Z
      • Hilf Al-Fudul
      • HiOperator (YC S16) Is Hiring VP of Engineering
      • HN を指します: Socketify.py: PyPy3 および Python3 用の Http/Https および WebSocket サーバー
      • How kind I blueprint a pair of buttocks?
      • How will the haj switch as international temperatures upward thrust?
      • Human gene linked to bigger brains turned into as soon as born from apparently pointless DNA
      • Hundreds of scientists publish a paper every 5 days
      • In Favor of Friction and Flexibility
      • Indicate HN: Klotho – Change into straightforward code into cloud native code
      • Indoor farming isn’t exact for the smartly off
      • Iranian assault drone came across to have parts from more than a dozen US companies
      • Israeli researcher experiences leak of 235M Twitter-linked e-mail addresses
      • Jam Stations in Low Earth Orbit
      • Jazz Is Freedom
      • JPL-20171102-TECHf-0001-ドローントリップ 人間vs機械 2017-11-17T00:00:00Z
      • JPL에서 NASA의 MSI 콘도미니엄 액셀러레이터 2022-08-25T00:00:00Z
      • JPSO extinct facial recognition abilities to arrest a man. The tech modified into once defective
      • jsc2017e136097 – 12 月 4 日,俄罗斯联邦地区公司 (Roscosmos) 的远征 54-55 号机组人员 Anton Shkaplerov 在俄罗斯 Principal person City 的加加林宇航员训练中心上向整洁的祝福者挥手致意,当时他登上了前往附近的 Chkalovsky Ai 的公共汽车2017-12-04T00:00:00Z
      • Kemble’s Cascade of Stars
      • Kepler-90 マシン (アーティストの考え) 2017-12-14T00:00:00Z
      • Koichi Wakata SpaceX 코칭 2022-06-27T00:00:00Z
      • KSC and Proud to Be Heart-Wide Diversity Tournament 2019-08-20T00:00:00Z
      • KSC ir „Proud to Be Center“ įvairovės turnyras 2019-08-20T00:00:00Z
      • AI
      • Artificial intelligence
      • Auto-Generate
      • anti-Mastodon
      • Awesome
      • BioSentinel
      • CATEGORIES
      • DC
      • Dione
      • Diversity
      • drone racing
      • drones
      • Dulles
      • education
      • Event
      • filmstock
      • Goddard
      • AI
      • Ask HN
      • autonomous
      • coding
      • computer science
      • Clusters
      • Artificial intelligence
        • Ai
        • Apple
        • Tesla
        • digital
        • MESSENGER
        • Device
        • Charts
        • change
        • Shows
        • fraud
        • Former
        • fucking
        • purge
        • Works
        • entering
        • Databases
        • Review
        • Strangely
        • Instinct
        • staff
        • Salesforce
        • intern
        • Involuntary
        • promise
        • Twilio’s
        • nisv live
        • attack
        • Iranian
        • France’s
        • prized
        • infrastructure
        • Debian-based
        • nisv s02 ep03
        • siduction
        • Awesome
        • Calculate
        • Beautiful
        • Linux
        • Start
        • dollar
        • Messier
        • Daughters
        • ‘Breakthrough’
        • obesity
        • Al-Fudul
        • sixty years
        • PyTorch
        • discloses
        • Ancient
        • Stone
        • Popup
        • design
        • public
        • expanding
        • cloud
        • forest
        • startup
        • French
        • batteries
        • fleas
        • spotted
        • Petals
        • language
        • Habitual
        • checking
        • GitHub
        • Availability
        • layers
        • inconsistencies
        • Affair
        • Quasi-War
        • Sergey
        • Irate
        • bestseller
        • necessarily
        • Scientists
        • Titan
        • twitch
        • FGS/NIRISS – Fine Guidance Sensor/Near InfraRed Imager and Slitless Spectrograph
        • infrared
        • ISIM – Integrated Science Instrument Module
        • JHU – Johns Hopkins University
        • JWST – James Webb Space Telescope
        • JWST – James Webb Space Telescope
        • absolute zero
        • Big Bang
        • Peace
        • Studio
        • Making
        • project
        • -gaps
        • warns
        • Germany
        • Braille
        • MotherDuck
        • prototype
        • Challenges
        • Infinite
        • OwnCloud
        • Novel
        • Before
        • copying
        • California
        • getting
        • States
        • Criminal
        • Brother
        • Released
        • Method
        • owners
        • ‘richsession’
        • email
        • Elements
        • Where
        • passenger
        • Hierarchy
        • Filesystem
        • economic
        • Crew Dragon
        • Bridenstine
        • Scientific
        • Heaviosity
        • Patterns
        • Unexpected
        • minimalist
        • Ecode
        • Alpha
        • Wolfram
        • Tailwind
        • HiOperator
        • Klotho
        • TEAMS
        • ROBOTICS
        • Antelope
        • Sponsors
        • Ellen Gertsen
        • Transform
        • Flightcontrol
        • subscriptions
        • Internet
        • Theory-building
        • you’re
        • looking
        • Transfer
        • error’
        • Tails
        • migrate
        • Building
        • Bitmovin
        • Remote
        • PhotoRoom
        • Company
        • Taking
        • Ribbon
        • BibDesk
        • Android
        • profilers
        • phones
        • modern
        • Mastercard
        • private
        • We’ve
        • reportedly
        • Microsoft
        • Artsy
        • trades
        • skilled
        • Polygon
        • Flying
        • Princeton
        • Codemods
        • Coaching
        • UK’s
        • popping
        • sourced
        • Wikipedia
        • admin
        • Indoor
        • quick
        • Mysterious
        • Spotify
        • Fancy
        • Spotify
        • Weird
        • mail-order
        • Recipients
        • computer
        • optics
        • partnership
        • commercial
        • telemetry
        • Crisis
        • billionaire
        • Party
        • Onelab
        • Faster
        • general
        • Adobe’s
        • database
        • FinanceDatabase
        • Numerical
        • Freedom
        • concrete
        • Stacks
        • computer science
        • NASA
    • Show HN
    • Ask HN
    • Technology
    • computer science
    • coding
    • Clusters
    • AI
    • drones
    • autonomous
    • Auto-Generate
    • Ask HN
    • Show HN
    • The SMART Science™
    • google
  • CRYPTO
    • Blockchain
    • farming
    • Billionaires
    • FTX’s
    • FinanceDatabase: A database of 300.000 symbols (ETFs, Currencies, Crypto)
  • Artificial intelligence
  • Toggle search form
  • 異例のヨーク・タイムズはあなたのプライバシーについてどのように考えているか – ロビン・ベルジョン著
    異例のヨーク・タイムズはあなたのプライバシーについてどのように考えているか – ロビン・ベルジョン著 anti-Mastodon
  • 通信の拡張 – ドローン – 主に完全にベースの無線中継器
    通信の拡張 – ドローン – 主に完全にベースの無線中継器 anti-Mastodon
  • JavaScript なしでアクセシブルなハンバーガー ボタン
    JavaScript なしでアクセシブルなハンバーガー ボタン Accessible
  • 4 ドルの VPS からどれだけ素晴らしいものを発見できますか?
    4 ドルの VPS からどれだけ素晴らしいものを発見できますか? Artificial intelligence
  • 命令 HN: Replit) うなり声 No to Things
    命令 HN: Replit) うなり声 No to Things Awesome
  • アプリケーションの安全性よりも _FORTIFY_SOURCE=3 の使用を優先する方法
    アプリケーションの安全性よりも _FORTIFY_SOURCE=3 の使用を優先する方法 anti-Mastodon
  • CTR は、ソルトン海の地熱塩水からの効率的なリチウム抽出を実現します
    CTR は、ソルトン海の地熱塩水からの効率的なリチウム抽出を実現します achieves
  • Amazon は、米国と中国の両方でラント ビジネスを根本的に変革しました。
    Amazon は、米国と中国の両方でラント ビジネスを根本的に変革しました。 Amazon
  • Docker レジストリ アドレスを格納するためのアイデア
    Docker レジストリ アドレスを格納するためのアイデア anti-Mastodon
  • Display HN: Touca – スナップショットのチェックアウトとの大きな違い
    Display HN: Touca – スナップショットのチェックアウトとの大きな違い alternative
  • Swift は、Rust ができなかった動的リンクを実行しました
    Swift は、Rust ができなかった動的リンクを実行しました Achieved
  • SpaceX CRS-15 What’s on Board Briefing 2018-06-28T00:00:00Z
    SpaceX CRS-15 What’s on Board Briefing 2018-06-28T00:00:00Z Artificial intelligence
  • Midjourney と Balance AI が訴えられる
    Midjourney と Balance AI が訴えられる anti-Mastodon
  • Databases in 2022: A 365 days in Evaluate
    Databases in 2022: A 365 days in Evaluate Artificial intelligence
  • AI の近未来図は循環主導型
    AI の近未来図は循環主導型 Action-Driven
ESM および CommonJS 用のハイブリッド NPM モジュールの作成

ESM および CommonJS 用のハイブリッド NPM モジュールの作成

Posted on March 3, 2023 By 📢 ℕ𝔸𝕊𝔸™
2021年2月12日

gordianどうやって ESM と CommonJS 用の NPM モジュールを組み立てることができますか?理想的には、上昇する 2 つのソース ベースを使用せず、Webpack を必要としませんか?それはしばらくクエリを保存するのに面倒でした.単一のコードから NPM モジュールを作成することは、CommonJS と ES モジュールの両方をターゲットにしていると主張することなく不適切であり、単にフラストレーションを感じるだけかもしれません。 単に import または require はとらえどころのないプロットです.

このトピックについては、無限のウェブログ記事、スタック オーバーフローに関する質問、および参照ページがあります。 これらの既存の多数の競合する戦略は、試してみると一部のシナリオでは機能しますが、脆く、さまざまなシナリオでは失敗します。 ほとんどのソリューションには、Webpack、[“src”] の両方が必要です。 ロールアップ 、パーソナライズされたスクリプティングとアセンブル ツール、またはデュアル ソースの上昇と維持不適切。 そして、ほとんどの場合、効率的で純粋な ESM コードが生成されなくなります。読み取り時 Node documentation、Webpack と Rollup、ESM、CommonJS、UMD、AMD についての情報を収集します。 .mjs と を学習します。 .cjs 拡張機能は解決策であり、長い逃避ですが、ほとんどの開発者はそれらを好まないようです.kit.json style=”module” および 輸出 魔法のようにすべての機能を生み出す可能性のあるキー フレーズですが、市販されているとおりには機能しません。なんてガタガタガタガタ!!ハイブリッドモジュールの作成は、単に無音かもしれませんが、それほど複雑ではありません!やってみた .mjs と .cjs 重要なアセンブル ツールよりも大きなサイズで失敗する拡張機能 ロールアップ.

kit.jsonを試してみましたstyle フィールドですが、kit.json エクスポートとの混合で微弱な場合は絶対に失敗しました私は非常に多くのアプローチを試しましたが、単一または追加の運動条件で失敗することを見つけるのに最も簡単です.最後に、簡単で効果的に機能し、効率的な ESM コードを生成する解決策を見つけました。 不適切な単一のソース コードをサポートし、CommonJS および ESM のアプリとモジュールでも使用できるモジュールを作成します すべてで働くことができます 運動条件。 ただし、Webpack、サーバーレス フレームワーク、ESM プレゼンス ライン ツール、およびさまざまな ESM または CommonJS ライブラリによるサイド消費と並んで、私のすべてに対して絶対に機能します。.mjs

決議の概要を説明する前に、剣を保存するために不可欠な宣伝方法について説明させてください.

なぜ適切な運動をしなくなったのか .mjs または .cjs ESM を指す拡張子またはCommonJSコード?ノードはこれらを採用しましたソース ファイルの形式を指すソース コード ファイル拡張子。 一見、論理的に見えます。 拡張機能は通常、ファイル スタイルをチェックリストに入れるには不十分です。これは、単純なスタンド オンの私自身の非ハイブリッド エクササイズ条件で機能します。 ただし、ハイブリッド モジュールを作成する場合は、 .mjs を使用します。 and .cjs は、どちらもそれ以外の場合は、ソースをコピーして拡張機能を交換し、インポートステートメントで明示的な拡張機能を実行するためにソースコードにパッチを適用するためのパーソナライズされたツールを使用するか、台頭しています.

ESM コードでは、import ディレクティブでパスを指定する必要がありますインポートされたファイルに。 .mjs を含む URL からインポートする場合、コードにパッチを適用する必要があります。 .cjs ファイルからの要求に成功し、その逆も同様です。

おまけに、ほとんどのインストゥルメント チェーンが終了しなくなりましたが、適切に強化されました .mjs レコードデータ。 また、一部の Web サーバーは、.mjs ‘utility/json’ MIME スタイル。 許可されたバンドラーは、おそらくこれらのレコードデータを理解していないだけかもしれません。 これらのレコードデータを監視するために、構成ルーチンやマッピング ルーチンを作成したり、パーソナライズされたスクリプトを作成したりしています。

.mjs と を「愛する」人.cjs 拡張子。 ありがたいことに、決定があります。 kit.json style プロパティを入力します。kit.jsonスタイルプロパティの主張 gordian が付いているファイルか否かの申し立ての最後まで受け付けます。 .js 拡張子は ES モジュールまたは CommonJS モジュールで、Node は kit.json を考案しました。 style プロパティと規則。 スタイルを「モジュール」にスペースを空ける場合、すべてのレコードデータはそのアイテム化とサブディレクトリは、他のすべての kit.json または node_modules アイテム化が発生するまで、ESM であることを認識しています。 style を「commonjs」に空白すると、すべてのレコードデータが想定されます。 これらのデフォルトは、.cjs または .mjs[“src”] 拡張子.kit.json:

    {

“モデル” :

  • “1.2.3”
      ,

  • “スタイル”
  • :

  • “モジュール” }
          これは非常に効果的に機能しますが、キットは両方ともデフォルトでは「module」または「commonjs」。 キットをハイブリッドにして、ESM と CommonJS の両方のフォーマットをエクスポートしたい場合に何が起こるのでしょうか? 悲しいことに、ESM として消費されると「モジュール」になり、CommonJS によって消費されると「commonjs」になる条件付きスタイルを占有する方法はもはやないかもしれません.

          ノードは、キットのエクスポート エントリを定義する条件付き エクスポート プロパティを提示します。側面。 それにもかかわらず、これはもはやキット スタイルと スタイル と exports プロパティが効果的に結合されなくなりました。kit.json 条件付きエクスポートの主張 条件付き エクスポート プロパティは、エントリ アスペクトのスペースを定義します。 私たちの機能については、 import と require セレクターは、ハイブリッド モジュールが ESM による演習のさまざまなエントリの側面を説明できるようにします。 CommonJS.

          kit.json:

          {

        • 「輸出」
            : { “輸入”: “./dist/mjs/index.js”, “必須”: “./dist/cjs/ index.js”

            }
          • }

        • ツール (下の色目) を使用して、ESM と CommonJS をプロットするには不適切な 1 つのソース コードから 2 つのディストリビューションを生成します。 exports プロパティは、ノードにリンクされたエントリ ポイントをロードするように指示します。

          それにもかかわらず、スタイル のモジュールと exports ESM と CommonJS の両方。 index.js の読み込みにはすべてうまく機能しますが、そのファイルが他のすべてのサブモジュール (./submodule.js など) を除いて大量になる場合、そのファイルは kit.json ごとに読み込まれます。 style 周辺であり、もはやエクスポート周辺ではありません.

          さまざまな言い方をすると、CommonJS アプリ/ライブラリがこのモジュールを require に弱体化させる場合 と “./dist/cjs/index.js” からの貨物、そして ‘index.js’ は require(‘./ submodule.js’)、モジュールの kit.json に style スペースから module および ESM モジュールは、require の実行を制限します。その下のコードが CommonJS であることを選択しなくなりました。 エクスポートがチップレベルのkit.jsonスタイルをオーバーライドするモジュールスタイルをおそらく説明している場合、おそらく非常に理想的である可能性があります.

          仮定の kit.json (実行しないでください。ノードではサポートされなくなりました):

          { 「輸出」: { “輸入”:

           

          {

            “コース” : “./dist/ mjs/index.js”, “スタイル”:

                  “モジュール” },

                    “必須”: {

            “コース”: “./dist/cjs/index.js”, “スタイル”:

          • “commonjs” }
              } } しかし、これは適切な夢物語です.もう 1 つの余分なしわ、TypeScript はもうありません (しかし) エクスポートで動作します。 したがって、従来の モジュール と main TypeScript のプロパティ。 main プロパティは、CJS エントリ ポイントと module ESM エントリへのプロパティの側面。

                "主要"

                :

                    )"dist/cjs/index.js"

                      , 「モジュール」

                        : "dist/mjs/index.js",

                    解像度

                    )K では、育て方のコツとは:

                  • 単一ソースコード不適切
                  • 簡単な組み立て ネイティブ ESM コードを生成します既存のツールで動作します ESM または CommonJS の両方のハイブリッド キットを生成します

                  • Single Source Execrable

                    ES6 でコードを作成し、 ES-Next や Typescript の import と export の使い方 インポートを使用して、ES モジュールまたは CommonJS モジュールの両方を適切にインポートします。 逆はもはや適切ではありません。 CommonJS で作成する場合は、ES モジュールを使用する必要がなくなる可能性があります。

                    輸入 形 から ‘./ Shape.js’ 輸出 クラス MyS hape

                    {

                  コンストラクタ

                  () { これ.形 =

                    個性的

                      )形() }

                        }

                          export default の使用法をインポートして使用する場合は注意が必要です。 requireのCommonJSの能力による。 TypeScript または Babel トランスパイラーは、エクスポート real を module.exports に自動的にバンドルし、インポート時に「.default」参照を生成します。代わりに、ネイティブの NodeJS はもう使用しません。 この式は、トランスパイラーを使用しなくなった場合、おそらく .default を実行する必要がある可能性があります。 参照。

                          輸入 形 から  './Shape.js' const

                          形 = 個性的 形.

                            デフォルト

                          ()

                            建物

                            ソースを ESM 用と CommonJS 用の 2 回用意します。

                            Typescript をトランスパイラーとして実行し、ES6/ES- で作成します次またはタイプスクリプト。 または、Babel は ES6 でうまく機能します。Javascript レコードデータは .js 拡張であり、もはや .mjs[“node_modules”, “dist”] ではありません または .cjs 拡大。 Typescript recordsdata は、.ts 拡張子を占めることができます.kit.json アセンブル スクリプトは次のとおりです: kit.json:

                             {  

                            「スクリプト」 :

                              {

                                “組み立てる”:

                                  “rm -fr dist/&& tsc -p tsco nfig.json && tsc -p tsconfig-cjs.json && ./fixup”

                                    }

                                      )}

                                      tsconfig.json[

                                  “src”] は、ESM および tsconfig-cjs.json 用にアセンブルするようにセットアップされています。 は CommonJS 用にビルドします。 設定の重複を判断するために、共有 tsconfig-inproperty.json には、ESM ビルドと CommonJS ビルドの両方に弱い共有アセンブル設定が含まれています。デフォルト tsconfig.json は ESM 用で、「esnext」の使用法をビルドします。 これを「es2015」または任意のプリセットに交換します

                                  tsconfig.json:

                                    { 「伸びる」

                                      : "./tsconfig-inproperty.json",

                                    “コンパイラオプション” :

                                  { “モジュール”

                                    : 「エスネクスト」,

                                    “outDir” :

                                    "dist/mjs" ,   

                                    “プロット”: 「エスネクスト」 } }

                                    • tsconfig-cjs.json:

                                      { 「伸びる」: “./ tsconfig-inappro priate.json”, “コンパイラオプション” :

                                        { “モジュール”:

                                          「commonjs」 , “outDir” : “dist/cjs”

                                            , “プロット”:

                                              「es2015」 } }

                                            これが tsconfig です-すべての共有設定を含む ES6 コード用の inproperty.json:

                                            tsconfig-inproperty.json:

                                            {

                                                “コンパイラオプション”

                                                  :

                                                    {

                                                      “allowJs” :

                                                        適切な, “allowSyntheticDefaultImports” : 適切な

                                                        ,
                                                      • 」 baseUrl”:
                                                          “src” 、

                                              “宣言”: 適切な, “esModuleInterop” :

                                                適切な, “inlineSourceMap”: 真実でない

                                                  ,

                                                    "lib"   : 

                                                  、

                                              “listEmittedFiles” : 真実でない

                                                ,

                                        “listFiles”:

                                          嘘 , 「モジュール解像度」

                                            : “ノード”, “noFallthroughCasesInSwitch”:

                                              適切な,  

                                            「コメリ」 : 適切な, “resolveJsonModule”: 適切な,

                                              “rootDir” :

                                                “src”, “skipLibCheck”: 適切な ,

                                                  “厳しい”: 適切な, “traceResolution”:

                                                  うそ ,

                                                    「種類」 :

                                                      [

                                                    “node”, “jest”]

                                                      }, “compileOnSave”: 真実でない

                                                        ,

                                                          "除外"
                                                          : ["node_modules", "dist"],

                                                        “からなる”: [“src”] }

                                                         

                                            ESM/CJS kit.json ごと

                                            組み立ての最後のステップは簡単です ディストリビューションごとに kit.json を作成する fixup スクリプト レコードデータ。 これらの kit.json レコードデータは、.dist/のデフォルトのキット スタイルを説明します。 サブディレクトリ。

                                            修正:

                                            猫 >dist/cjs/kit.json >dist/mjs/kit.json

                                              <

                  anti-Mastodon, Ask HN, Auto-Generate, Billionaires, Blockchain, coding, computer science, Creating, CRYPTO, Hybrid, Show HN, Technology, TOP HN Tags:Blockchain, Creating, Hybrid

                  Post navigation

                  Previous Post: シークレット キャリアと ICE が令状なしのスティングレイ監視を実施
                  Next Post: OptOut の目的は、「企業のメディア報道から 100% 解放される」毎日のニュース アプリになることです。

                  Related Posts

                  • Show HN: PMF にピックアップ AI 実行でより早く 特定人物インタビュー
                    Show HN: PMF にピックアップ AI 実行でより早く 特定人物インタビュー anti-Mastodon
                  • Samsung は複合現実ヘッドセットで Google および Qualcomm と提携
                    Samsung は複合現実ヘッドセットで Google および Qualcomm と提携 anti-Mastodon
                  • ChatGPT AI のハイプ サイクルはピークに達している
                    ChatGPT AI のハイプ サイクルはピークに達している anti-Mastodon
                  • Sentry のセッション リプレイ
                    Sentry のセッション リプレイ anti-Mastodon
                  • 数千万人のユーザーのために世界中で ChatGPT ダウン
                    数千万人のユーザーのために世界中で ChatGPT ダウン anti-Mastodon
                  • AI を活用した創造性: GPT-4 が作曲にどのように役立ったか Dripart.io
                    AI を活用した創造性: GPT-4 が作曲にどのように役立ったか Dripart.io AI-Powered
                  • 顧客がパッチの適用に失敗した後、Fortinet と Zoho が損害を受ける世界
                    顧客がパッチの適用に失敗した後、Fortinet と Zoho が損害を受ける世界 anti-Mastodon
                  • Twitter は荒らしからあなたを保護することはできません、インサイダーはため息をつきます
                    Twitter は荒らしからあなたを保護することはできません、インサイダーはため息をつきます anti-Mastodon
                  • Eduard: Swiss-Style Relief Shading 機械学習の使い方
                    Eduard: Swiss-Style Relief Shading 機械学習の使い方 anti-Mastodon
                  • Launch-Vsx.org をサポートしてください
                    Launch-Vsx.org をサポートしてください anti-Mastodon

                  Recent Posts

                  • PyPI ウェブログへようこそ
                  • Discovering out eBPF – O'Reilly から簡単に入手できる電子ブック
                  • '94年からのThey MayおそらくBe Giants「John Henry」Hypercardスタックのネットゲーム
                  • サイコロの写真からゲームボーイのROMを取り出す
                  • Uncover HN: コモディティ GPU で LLaMA-7B を微調整して、ホールド テキスト エクスプレス マテリアルを消費します

                  Recent Comments

                  1. robga on Excessive Avenue コーヒーのカフェイン ステージはさまざまで、テストでは
                  2. Loic on 行方不明の放射性タブレットは、必死の捜索の後、WA奥地で偶然見つけました
                  3. minihat on メタは、標準的な VR e スポーツ Echo Area をシャットダウンします
                  4. dafelst on フレーム ポインターの巻き戻しによる Move 実行トレーサーのオーバーヘッドの削減
                  5. cloudking on GraphGPT: 構造化されていないテキストの肯定的な素材からのレコードデータ グラフの外挿
                  • 「コンピューターは空想を可能にする」 – ワイゼンバウムの警告の永続的な関連性
                    「コンピューターは空想を可能にする」 – ワイゼンバウムの警告の永続的な関連性 anti-Mastodon
                  • Dialog abilities essentials
                    Dialog abilities essentials Artificial intelligence
                  • GitHub Copilot ユーザーが参照するコードの 40% は、AI によって生成され、変更されていません。
                    GitHub Copilot ユーザーが参照するコードの 40% は、AI によって生成され、変更されていません。 Artificial intelligence
                  • C/C++ を使用して信頼できる Redis を製造する
                    C/C++ を使用して信頼できる Redis を製造する Artificial intelligence
                  • MiniFB: Unfavorable-Platform Rendering Library
                    MiniFB: Unfavorable-Platform Rendering Library anti-Mastodon
                  • Show HN: PC Face: CP-437 の 256 個のグリフすべてをレンダリングするためのビットマップ配列
                    Show HN: PC Face: CP-437 の 256 個のグリフすべてをレンダリングするためのビットマップ配列 arrays
                  • Dwarf Fortress has bought half of 1,000,000 copies
                    Dwarf Fortress has bought half of 1,000,000 copies Artificial intelligence
                  • AIで金持ちになったのは誰?
                    AIで金持ちになったのは誰? anti-Mastodon
                  MAILANON
                  2100 MAIL
                  SEO
                  METAVERSE
                  BioLINK
                  CRYPTO MINING
                  CASINO
                  DEFI-TRACKER
                  StartApp Network
                  RAVES-MONSTER-GAME
                  RAVES EXCHANGE
                  RAVES NFT
                  KVANTA TV

                  Copyright © 2023 Nasare™🚀.

                  Powered by PressBook News Dark theme