2.3.3 • Published 5 years ago

babel-plugin-dynamic-import-node v2.3.3

Weekly downloads
12,594,953
License
MIT
Repository
github
Last release
5 years ago

babel-plugin-dynamic-import-node

Babel plugin to transpile import() to a deferred require(), for node. Matches the proposed spec.

NOTE: Babylon >= v6.12.0 is required to correctly parse dynamic imports.

Installation

npm install babel-plugin-dynamic-import-node --save-dev

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["dynamic-import-node"]
}

Options

  • noInterop - A boolean value, that if true will not interop the require calls. Useful to avoid using require('module').default on commonjs modules.
{
  "plugins": [
    ["dynamic-import-node", { "noInterop": true }]
  ]
}

Via CLI

$ babel --plugins dynamic-import-node script.js

Via Node API

require('babel-core').transform('code', {
  plugins: ['dynamic-import-node']
});

Code Example

Promise.all([
  import('./lib/import1'),
  import('./lib/import2')
 ]).then(([
   Import1,
   Import2
  ]) => {
   console.log(Import1);
   /* CODE HERE*/
  });
@dinert/utilsvuedragdropuploadimages@asep.setiawan/react-kit@jerryhorak/docusaurus-corereact-native-bluetooth2killi8n-react-native-fast-image@s-isabella/scripts-backendbabel-preset-react-app-motive-editorrn-send-sms@rock-kit/ui-babel-preset@nhatle/react-build-tools@cashremit/cr-streamline-iconsqinshixixing-rolluphometown.inreact-native-template-rfbasekelex-clikelex-plugin-app@deity/babel-preset-falcon-client@deity/falcon-scriptsairscanairscan-examplebb-chat@nghiepuit/sdk-builderbase-sdk-buildernghiepuit-build-toolsreact-native-esc-pos-sahaab@nghiepuit/react-build-tool@borisovart/atol-kkt-moduledeneme323112@primal/server@texttree/demo-bsa-reference-rclbabel-preset-fswq@joseirrazabal/kit@startdt/next-preset-app@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjames@code.gov/code-gov-front-end@codewitchbella/scripts-backend@startdt/babel-preset-appreact-native-covid-sdkgql_din_modmicro-app-formbabel-preset-hiroreact-native-thanh-toast-librarybbc_cli@thanhnguyen14797/react-native-thanh-toast-library@jjavery/babel-preset-react-app@l1nyanm1ng/react-picture-viewer@ez-fe/core@lukeshay/babel-config-react-typescript@weilluo/react-ssr@wownikcompany/frontend-core@zelz/crank@saeon/ol-react@saeon/quick-formwebpackhtmly@futurelearn/webpack-config@olivervorasai/sliderreact-native-printer-brothersrn-pdf-reader-offline@maywide/admin-element@maywide/element@maywide/h5-element@maywide/television-npmcbmis-ai-toolboxbabel-preset-rvreact-native-shekhar-bridge-testasterjscogoportutilsbabel-preset-noctisbabel-preset-trigenbabel-preset-react-app-with-rhl@nehrdani/babel-preset-kickstartwilscanner@oiti/documentoscopy-react-nativecsr-iam-app-lib@mink-opn/build-tokensreact-native-slider-kfbabel-preset-mutual8@infinitebrahmanuniverse/nolb-babel-plugin-d@cyca/babel-presets@prodam/prodam-typesbabel-preset-create-packagehulionjsqgb-cformzxr-new-componentszxr-new-renders@everything-registry/sub-chunk-1202cherry-scriptsbabel-preset-x-react-app@merlion/ape-babel-presetaf-webpack-sudoku356-testmember-easy-mobile-v1@porosjs/preset-umitaman-baca-masyarakattapestry-litetb-registersyncano-cliwmm-package-cli-testwodax-af-webpack
2.3.3

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago