Description
How do I add an exception for a webpack loader? I need to transpile one dependency, and I know that node_modules folder gets excluded from transpiling. I have a dependency that I install from GitHub. I don't know how to set this up correctly with docz, and wondered in which direction should I look.
my doczrc.js file looks like this:
export default {
modifyBundlerConfig: config => {
const newConfig = config;
newConfig.module
.rule('js')
.test(/\.(js|jsx|mjs)$/)
.include.add(/node_modules\/circuit-ui/)
.end();
return newConfig;
},
};
but obviously it does not work. Do you have any suggestions ?
P.S. thank you for such a great project!
I have resolved the issue, will share my solution later.
@ilyanoskov , I'm having a similar issue, could you share what you came up with?
@good-idea , this is how I ended up doing it. I manually found the particular jsRule through console.logs and added an exclusion. Let me know if this helps :)
my doczrc.js :
import { babel } from 'docz-plugin-babel6';
export default {
plugins: [babel()],
modifyBundlerConfig: config => {
const jsRule = config.module.rules.find(rule => rule.test.test('*.js'));
jsRule.exclude = [/node_modules(?!\/circuit-ui)/];
return config;
},
};
Most helpful comment
@good-idea , this is how I ended up doing it. I manually found the particular jsRule through console.logs and added an exclusion. Let me know if this helps :)
my
doczrc.js: