babel-plugin-export-webpack-module-id
Adding webpackModuleId
to default export and named export, it's useful for HMR support
Installation
yarn
yarn add babel-plugin-export-webpack-module-id
npm
npm install babel-plugin-export-webpack-module-id
.babelrc:
"plugins": "export-webpack-module-id"
What it does
For each module, export webpackModuleId
Taking from the test snapshots, it does this:
{ var x = 5; console;} ↓ ↓ ↓ ↓ ↓ ↓ var { var x = 5; console;}; _refwebpackModuleId = moduleid;;const webpackModuleId = moduleid;
For more usages, please find the detail in
./__tests__/index.js
Options
webpackModuleId
:The property name of the module id. string
, default: 'webpackModuleId'
include
: which files to add module id. string | string[]
, default: undefined
exclude
: which files not to add module id. string | string[]
, has higher priority than include
, default: undefined