The plugin on enhanced-resolver for easy mock
MIT License
The plugin on enhanced-resolver for easy mock
One day your project (using React) needs to change the browser's default hovering title behavior as a whole.
This is a lot of work, so the implementation of small modifications is mock react module, so that the place where react is imported in the project points to our custom react module.
src/
__mock/
react/ # custom react
node_modules/
react/
src/__mock/react/index.js
import React from 'react'
export * from 'react'
export function createElement(type, props, children) {
// ... custom code
}
npm install module-mock-plugin
# or use yarn
yarn add module-mock-plugin
const ModuleMockPlugin = require('module-mock-plugin')
const webpackConfig = {
resolve: {
plugins: [new ModuleMockPlugin()]
}
}
Extends the options from absolute-module-mapper-plugin
mockFilePath
The path of mock directory, it could be inferred as the closest file from origin file, or assigning special file path by absolute path.
string
__mocks
include
The included paths for mapping
Array<string|Function|RegExp>
[/^((?!\/node_modules\/).)*$/]
exclude
The excluded paths for mapping
Array<string|Function|RegExp>
[]
git checkout -b feature-new
or git checkout -b fix-which-bug
git commit -am 'feat: some description (close #123)'
or git commit -am 'fix: some description (fix #123)'
git push
This library is written and maintained by imcuttle, [email protected].
MIT - imcuttle 🐟