Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'use strict';
const path = require('path');
const fs = require('fs');
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
module.exports = {
modify: (defaultConfig, { target, dev }, webpack) => {
const config = Object.assign({}, defaultConfig);
config.module.rules = config.module.rules.reduce((rules, rule) => {
if (rule.test &&
rule.test.toString()===/\.(js|jsx|mjs)$/.toString() &&
!rule.enforce) {
const { include, ...rest } = rule;
rules.push({ ...rest, ...{
include: include.concat([resolveApp('api')])
}});
}
else {
rules.push(rule);
}
return rules;
}, []);
return config;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.