transform bare / url module specifiers in the import statement, export statement and dynamic import with importmap. see also rollup-plugin-import-maps
Contents:
npm install --save-dev babel-plugin-transform-import-maps
edit babel.config.json
{
"presets": [
["@babel/preset-env", {
"modules": false
}]
],
"plugins": [
["babel-plugin-transform-import-maps", {
"srcPath": "./index.importmap",
"transformingReport": "-"
}]
]
}
-
srcPath
:string optionalfile path to importmap
-
srcText
:string optionalplain text of importmap
-
srcObject
:Object optionalparsed object of importmap
Note: One of
srcObject
,srcText
,srcPath
should be specified, if multiple of them specified, then precedence order is: srcObject, srcText, srcPath. -
baseDir
: string defaultprocess.cwd()
baseDir to calculate scope paths in order to match scopes defined in importmap
-
transformingReport
:string defaultundefined
set a file path to save transforming report as a Concatenated JSON file, will output to Console if value set to
"-"
-
exclude
:string|RegExp|Function defaultundefined
skip bare/url specifiers from resolving / transforming according to importmap.
e.g.
/\.(json|wasm|css)$/
,(source, importer)=> /\.(json|wasm|css)$/.test(source)
,.css,.wasm,.json
- import-maps - Reference implementation playground for import maps proposal
Other licenses of dependencies
- import-maps: W3C Software and Document License and W3C CLA