https://github.com/WebReflection/import.js
A dynamic import() polyfill
https://github.com/WebReflection/import.js
Last synced: 9 months ago
JSON representation
A dynamic import() polyfill
- Host: GitHub
- URL: https://github.com/WebReflection/import.js
- Owner: WebReflection
- License: isc
- Archived: true
- Created: 2017-04-19T22:01:16.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-24T11:26:17.000Z (over 8 years ago)
- Last Synced: 2025-04-02T11:04:05.166Z (10 months ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 93
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# import.js
[](https://github.com/WebReflection/donate)
A dynamic [import()](https://tc39.github.io/proposal-dynamic-import/) polyfill.
Don't miss the [related blog post](https://twitter.com/WebReflection/status/856137076852621312).
### Features
- [x] compatible with **native ES2015** modules
- [x] compatible with native `import ... from ...`
- [x] compatible with common native `export ...` expressions
- [x] compatible with **Babel transpiled** ES2015 modules
- [x] compatible with **relative paths**
- [x] compatible with **absolute paths**
### Usage
```html
```
* the `src` should point to `import.js` or its `min.js` version
* the `data-main` should point to your module entry point
* feel free to use or not `deferred` or `async` to delay execution
* all modules will be loaded through `XHR` to avoid the need of a `fetch` polyfill
* however, you can add any polyfill you need upfront
Use `https://unpkg.com/import.js@latest` as source if you'd like to use a CDN service.
[Live test](https://webreflection.github.io/import.js/) based on [this folder](https://github.com/WebReflection/import.js/tree/master/js).
You can test [native ES2015 module export](https://webreflection.github.io/import.js/?native) too. It requires a compatible browser (today any modern WebKit would do).