Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inspect-js/has-dynamic-import
Does the current environment have `import()` support?
https://github.com/inspect-js/has-dynamic-import
detect dynamic ecmascript esm esmodules has import javascript modules
Last synced: about 2 months ago
JSON representation
Does the current environment have `import()` support?
- Host: GitHub
- URL: https://github.com/inspect-js/has-dynamic-import
- Owner: inspect-js
- License: mit
- Created: 2021-05-13T17:53:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-11T04:31:55.000Z (10 months ago)
- Last Synced: 2024-10-30T10:51:36.775Z (2 months ago)
- Topics: detect, dynamic, ecmascript, esm, esmodules, has, import, javascript, modules
- Language: JavaScript
- Homepage:
- Size: 72.3 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# has-dynamic-import [![Version Badge][npm-version-svg]][package-url]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url][![npm badge][npm-badge-png]][package-url]
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()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#dynamic_imports); 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`
[package-url]: https://npmjs.org/package/has-dynamic-import
[npm-version-svg]: https://versionbadg.es/inspect-js/has-dynamic-import.svg
[deps-svg]: https://david-dm.org/inspect-js/has-dynamic-import.svg
[deps-url]: https://david-dm.org/inspect-js/has-dynamic-import
[dev-deps-svg]: https://david-dm.org/inspect-js/has-dynamic-import/dev-status.svg
[dev-deps-url]: https://david-dm.org/inspect-js/has-dynamic-import#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/has-dynamic-import.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/has-dynamic-import.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/has-dynamic-import.svg
[downloads-url]: https://npm-stat.com/charts.html?package=has-dynamic-import
[codecov-image]: https://codecov.io/gh/inspect-js/has-dynamic-import/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/has-dynamic-import/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-dynamic-import
[actions-url]: https://github.com/inspect-js/has-dynamic-import/actions