index.js 841 B

12345678910111213141516171819202122232425262728293031323334353637
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports['default'] = function (api) {
  6. var transformImport = (0, _utils.createDynamicImportTransform)(api);
  7. return {
  8. // NOTE: Once we drop support for Babel <= v6 we should
  9. // update this to import from @babel/plugin-syntax-dynamic-import.
  10. // https://www.npmjs.com/package/@babel/plugin-syntax-dynamic-import
  11. manipulateOptions: function () {
  12. function manipulateOptions(opts, parserOpts) {
  13. parserOpts.plugins.push('dynamicImport');
  14. }
  15. return manipulateOptions;
  16. }(),
  17. visitor: {
  18. Import: function () {
  19. function Import(path) {
  20. transformImport(this, path);
  21. }
  22. return Import;
  23. }()
  24. }
  25. };
  26. };
  27. var _utils = require('./utils');
  28. module.exports = exports['default'];