speedskater / babel-plugin-rewire

A babel plugin adding the ability to rewire module dependencies. This enables to mock modules for testing purposes.
843 stars 90 forks source link

How can I enable this for one module only? #220

Closed josh08h closed 5 years ago

josh08h commented 5 years ago

I don't want to include this for all modules as it bloats the bundle.

How can I specify I only add the getter/setter for a specified module?

I guess an inline loader would suffice but how can I use this via an inline loader? Something along the lines of import { __RewireAPI__ as ajaxApi } from 'babel-loader?plugins=babel-plugin-rewire!../../banco-ui/util/ajax';

josh08h commented 5 years ago

Figured it: import { __RewireAPI__ as ajaxApi } from 'babel-loader?plugins[]=rewire!../../banco-ui/util/ajax';