craco
craco copied to clipboard
How can i merge these two configure props in webpack config override (craco.config.js)?
Hello! Sorry for bothering and asking silly questions, but i'm making my first steps in overriding CRA without ejecting and i'm confused - how to have one configure property instead of two ones (as on example below)?
Example:
const path = require('path');
const tsNameof = require("ts-nameof");
const overridenPaths = require('./config/paths');
module.exports = {
webpack: {
alias: {
'@public': path.resolve(__dirname, "public/"),
'@': path.resolve(__dirname, "src/"),
},
configure: {
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve('ts-loader'),
options: {
transpileOnly: true,
getCustomTransformers: () => ({before: [tsNameof]}),
},
},
],
},
],
},
},
configure: (webpackConfig, {env, paths}) => {
paths.appBuild = webpackConfig.output.path = overridenPaths.customBuildDir;
return webpackConfig;
}
}
}
Nevermind.