How to use config-local.json in Sage 9?

Hello, I’m curious to know if the config-local.json in Sage 9 has been implemented or not. I couldn’t find any information regarding it.

I’ve tried copying the content from config.json to config-local.json however webpack complains with an Invalid configuration object error. Here’s the full error for the record

    Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.entry should be one of these:
   object { <key>: non-empty string | [non-empty string] } | non-empty string | [non-empty string] | function
   The entry point(s) of the compilation.
   Details:
    * configuration.entry['main'] should be a string.
    * configuration.entry['main'] should NOT have duplicate items (items ## 2 and 4 are identical) ({
        "keyword": "uniqueItems",
        "dataPath": ".entry['main']",
        "schemaPath": "#/definitions/common.nonEmptyArrayOfUniqueStringValues/uniqueItems",
        "params": {
          "i": 4,
          "j": 2
        },
        "message": "should NOT have duplicate items (items ## 2 and 4 are identical)",
        "schema": true,
        "parentSchema": {
          "items": {
            "minLength": 1,
            "type": "string"
          },
          "minItems": 1,
          "type": "array",
          "uniqueItems": true
        },
        "data": [
          "path-to-my-theme/wp-content/themes/sagetest/resources/assets/build/util/../helpers/hmr-client.js",
          "./scripts/main.js",
          "./styles/main.scss",
          "./scripts/main.js",
          "./styles/main.scss"
        ]
      }).
      [non-empty string]
    * configuration.entry['main'] should be one of these:
      non-empty string | [non-empty string]
    * configuration.entry['customizer'] should be a string.
    * configuration.entry['customizer'] should NOT have duplicate items (items ## 1 and 2 are identical) ({
        "keyword": "uniqueItems",
        "dataPath": ".entry['customizer']",
        "schemaPath": "#/definitions/common.nonEmptyArrayOfUniqueStringValues/uniqueItems",
        "params": {
          "i": 2,
          "j": 1
        },
        "message": "should NOT have duplicate items (items ## 1 and 2 are identical)",
        "schema": true,
        "parentSchema": {
          "items": {
            "minLength": 1,
            "type": "string"
          },
          "minItems": 1,
          "type": "array",
          "uniqueItems": true
        },
        "data": [
          "path-to-my-theme/wp-content/themes/sagetest/resources/assets/build/util/../helpers/hmr-client.js",
          "./scripts/customizer.js",
          "./scripts/customizer.js"
        ]
      }).
      [non-empty string]
    * configuration.entry['customizer'] should be one of these:
      non-empty string | [non-empty string]
    * configuration.entry should be a string.
    * configuration.entry should be an array:
      [non-empty string]
    * configuration.entry should be an instance of function
      function returning an entry object or a promise..

Any information regarding this would be highly appreciated, thank you!

config-local just takes precedence by being merged in. Maybe there’s an issue with webpack-merge.

Is your config standard or has been it been modified?

webpack-merge does have some options for dealing with arrays, maybe that’s the issue with your config or the standard Sage one.

See https://github.com/survivejs/webpack-merge for docs on it.

Thank you for taking the time to reply!

My config-local.json was an exact copy of the default config.json. I had to remove the “entry” block to make it work.

2 Likes