react-universally
react-universally copied to clipboard
additionalNodeBundles - Invalid configuration object.
So - first of all - I love the project. Using it in second app and it works really great.
I had my API server running along with the React one, but now as it's growing - I wanted to separate those. What I did is:
- Created an
apifolder in the project's root withindex.jsfile and an express listener -
index.jscontains just basic code to see if the server is running - I uncommented the code in
additionalNodeBundlesinsideconfig/valuesso it looks like this:
additionalNodeBundles: {
apiServer: {
srcEntryFile: './api/index.js',
srcPaths: [
'./api',
'./shared',
'./config',
],
outputPath: './build/api',
},
},
Now while running the development mode I get:
DEVELOPMENT: Webpack config is invalid, please check the console for more information.
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module.rules[0].oneOf[1] should be an object.
I only changed few things in the webpack/configFactory (like disabled CSS modules).
Should I add additional ifElse with new target like this to make this work? Do we have any examples on how to do this?
const isProd = optimize;
const isDev = !isProd;
const isClient = target === 'client';
const isServer = target === 'server';
const isNode = !isClient;
const isAPI = target === 'apiServer';
const ifAPI = ifElse(isAPI);
...