Skip to content
This repository has been archived by the owner on Jun 3, 2019. It is now read-only.

additionalNodeBundles - Invalid configuration object. #554

Open
mb8z opened this issue Jan 30, 2018 · 0 comments
Open

additionalNodeBundles - Invalid configuration object. #554

mb8z opened this issue Jan 30, 2018 · 0 comments
Labels

Comments

@mb8z
Copy link

mb8z commented Jan 30, 2018

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:

  1. Created an api folder in the project's root with index.js file and an express listener
  2. index.js contains just basic code to see if the server is running
  3. I uncommented the code in additionalNodeBundles inside config/values so 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);
...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants