1. has-dynamic-import
Does the current environment have `import()` support?
has-dynamic-import
Package: has-dynamic-import
Created by: inspect-js
Last modified: Sat, 13 Jan 2024 06:40:24 GMT
Version: 2.1.0
License: MIT
Downloads: 392,940
Repository: https://github.com/inspect-js/has-dynamic-import

Install

npm install has-dynamic-import
yarn add has-dynamic-import

has-dynamic-import Version Badge

github actions
coverage
dependency status
dev dependency status
License
Downloads

npm badge

Does the current environment have import() support?

At the time of this writing, node v12.17+, v13.2+ and v14.0+ has support for dynamic import(); the syntax is supported in node v10+.

The former can be checked in the package‘s main export, which is an async function that returns a boolean indicating if the current environment fully supports dynamic import. Note that in node v12.17 - v12.19 and v13.4 - v13.13, an ExperimentalWarning will be logged.

The latter can be checked with 'has-dynamic-import/syntax', which is a function that returns a boolean indicating if the current environment supports parsing the syntax of dynamic import.

Tests

Simply clone the repo, npm install, and run npm test

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code