项目原始demo,不改动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

README.md 920 B

123456789101112131415161718192021222324252627282930313233
  1. # Dynamic import support in acorn
  2. This is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
  3. For more information, check out the [proposal repo](https://github.com/tc39/proposal-dynamic-import).
  4. ## Usage
  5. You can use this module directly in order to get Acorn instance with plugin installed:
  6. ```js
  7. import acorn from 'acorn-dynamic-import';
  8. // or...
  9. const acorn = require('acorn-dynamic-import').default;
  10. ```
  11. Or you can use `inject.js` for injecting plugin into your own version of Acorn like this:
  12. ```js
  13. const acorn = require('acorn-dynamic-import/lib/inject').default(require('./custom-acorn'));
  14. ```
  15. Then, use the `plugins` option whenever you need to support dynamicImport while parsing:
  16. ```js
  17. const ast = acorn.parse(code, {
  18. plugins: { dynamicImport: true }
  19. });
  20. ```
  21. ## License
  22. This plugin is issued under the [MIT license](./LICENSE).