SOLFIND
Web Lens
Portal home

@babel/plugin-syntax-module-blocks · Babel

https://babeljs.io/docs/babel-plugin-syntax-module-blocks • 32 KB fetched
Open original page


@babel/plugin-syntax-module-blocks · Babel Skip to main content Docs Setup Try it out Videos Blog Search Donate Team GitHub * Modules * TC39 Proposals * Stage 3 * Early stages * async-do-expressions * destructuring-private * discard-binding * do-expressions * export-default-from * function-bind * function-sent * import-defer * optional-chaining-assign * partial-application * pipeline-operator * record-and-tuple * throw-expressions * syntax-module-blocks * Web Compatibility * * TC39 Proposals * Early stages * syntax-module-blocks On this page @babel/plugin-syntax-module-blocks Example ​ This plugin enables @babel/parser to parse module declarations module countModule { let i = 0 ; export function count ( ) { i ++ ; return i ; } } It requires @babel/parser@^7.13.0 . Installation ​ * npm * Yarn * pnpm * Bun npm install --save-dev @babel/plugin-syntax-module-blocks yarn add --dev @babel/plugin-syntax-module-blocks pnpm add --save-dev @babel/plugin-syntax-module-blocks bun add --dev @babel/plugin-syntax-module-blocks Usage ​ With a configuration file (Recommended) ​ babel.config.json { "plugins" : [ "@babel/plugin-syntax-module-blocks" ] } Via CLI ​ Shell babel --plugins @babel/plugin-syntax-module-blocks script.js Via Node API ​ JavaScript require ( "@babel/core" ) . transformSync ( "code" , { plugins : [ "@babel/plugin-syntax-module-blocks" ] , } ) ; Edit this page Previous throw-expressions Next import-attributes-to-assertions * Example * Installation * Usage * With a configuration file (Recommended) * Via CLI * Via Node API Docs * Learn ES2015 Community * Videos * User Showcase * Stack Overflow * Slack Channel * X (Twitter) * Bluesky More * Blog * GitHub Org * GitHub Repo * Website Repo * Old 7.x Site * Old 6.x Site * Old 5.x Site

Links found on this page

  1. Skip to main content [direct]
  2. Docs [direct]
  3. Setup [direct]
  4. Try it out [direct]
  5. Videos [direct]
  6. Blog [direct]
  7. Donate [direct]
  8. Team [direct]
  9. GitHub [direct]
  10. Modules [direct]
  11. TC39 Proposals [direct]
  12. Early stages [direct]
  13. destructuring-private [direct]
  14. discard-binding [direct]
  15. do-expressions [direct]
  16. export-default-from [direct]
  17. function-bind [direct]
  18. function-sent [direct]
  19. import-defer [direct]
  20. optional-chaining-assign [direct]
  21. partial-application [direct]
  22. pipeline-operator [direct]
  23. record-and-tuple [direct]
  24. throw-expressions [direct]
  25. Web Compatibility [direct]
  26. Edit this page [direct]
  27. Learn ES2015 [direct]
  28. User Showcase [direct]
  29. Stack Overflow [direct]
  30. Slack Channel [direct]
  31. X (Twitter) [direct]
  32. Bluesky [direct]
  33. GitHub Org [direct]
  34. Website Repo [direct]
  35. Old 7.x Site [direct]
  36. Old 6.x Site [direct]
  37. Old 5.x Site [direct]