babel-plugin-module-name-mapper
Advanced tools
Comparing version
{ | ||
"name": "babel-plugin-module-name-mapper", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Babel plugin to map module resolution", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -45,7 +45,6 @@ # Babel Module Name Mapper Plugin | ||
[ | ||
'babel-plugin-module-name-mapper', | ||
'module-name-mapper', | ||
{ | ||
moduleNameMapper: { | ||
'^src/(.*)': '<pkgDir>/src/$1', | ||
underscore: 'lodash' | ||
'^src/(.*)': '<pkgDir>/src/$1' | ||
} | ||
@@ -58,13 +57,21 @@ } | ||
### Examples | ||
### Other examples | ||
```js | ||
module.exports = { | ||
moduleNameMapper: { | ||
'^src/(.*)': '<pkgDir>/src/$1', | ||
'^image![a-zA-Z0-9$_-]+$': 'GlobalImageStub', | ||
'^[./a-zA-Z0-9$_-]+\\.png$': '<rootDir>/RelativeImageStub.js', | ||
'^module_name_(.*)': '<rootDir>/substituted_module_$1.js', | ||
underscore: 'lodash' | ||
} | ||
presets: [['@babel/preset-env']], | ||
plugins: [ | ||
[ | ||
'module-name-mapper', | ||
{ | ||
moduleNameMapper: { | ||
'^src/(.*)': '<pkgDir>/src/$1', | ||
'^image![a-zA-Z0-9$_-]+$': 'GlobalImageStub', | ||
'^[./a-zA-Z0-9$_-]+\\.png$': '<rootDir>/RelativeImageStub.js', | ||
'^module_name_(.*)': '<rootDir>/substituted_module_$1.js', | ||
underscore: 'lodash' | ||
} | ||
} | ||
] | ||
] | ||
}; | ||
@@ -71,0 +78,0 @@ ``` |
20211
0.56%125
5.93%