Shopify / slate

Slate is a toolkit for developing Shopify themes. It's designed to assist your workflow and speed up the process of developing, testing, and deploying themes.
https://shopify.github.io/slate
MIT License
1.28k stars 364 forks source link

Cannot update slate from beta9 to beta14 (webpack config error) #930

Open mattaebersold opened 5 years ago

mattaebersold commented 5 years ago

Problem

I'm having some trouble in beta9 with requesting assets, so I want to upgrade to beta14. The problem is when I try to yarn start after updating, I get an immediate error saying that the webpack config is not configured properly. But the actual webpack config is in the slate-tools package.

Replication steps

TRIED without success:

More Information

I went to the slate update wiki page, and it seems pretty basic, like "just update slate tools". I feel like that's a little too simplistic, and needs more information there like troubleshooting, common problems, etc.

In addition, it's worth noting that this isn't just a problem when trying to update to 14, I also tried beta12 initially with no effect.

Here is the output

yarn run v1.12.3
$ slate-tools start
{ WebpackOptionsValidationError: 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:
   function | object { <key>: non-empty string | [non-empty string] } | non-empty string | [non-empty string]
   -> The entry point(s) of the compilation.
   Details:
    * configuration.entry should be an instance of function
      -> A Function returning an entry object, an entry string, an entry array or a promise to these things.
    * configuration.entry should not be empty.
      -> Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.
    * configuration.entry should be a string.
      -> An entry point without name. The string is resolved to a module which is loaded upon startup.
    * configuration.entry should be an array:
      [non-empty string]
    at webpack (/Users/matthewaebersold/Helium/rdbody/rdbody/node_modules/webpack/lib/webpack.js:31:9)
    at new DevServer (/Users/matthewaebersold/Helium/rdbody/rdbody/node_modules/@shopify/slate-tools/tools/asset-server/index.js:21:21)
    at Promise.all.then (/Users/matthewaebersold/Helium/rdbody/rdbody/node_modules/@shopify/slate-tools/cli/commands/start.js:46:19)
  details: undefined,
  missing: undefined,
  origin: undefined,
  dependencies: undefined,
  module: undefined,
  name: 'WebpackOptionsValidationError',
  validationErrors:
   [ { keyword: 'anyOf',
       dataPath: '.entry',
       schemaPath: '#/properties/entry/anyOf',
       params: {},
       message: 'should match some schema in anyOf',
       schema: [ { '$ref': '#/definitions/Entry' } ],
       parentSchema:
        { description: 'The entry point(s) of the compilation.',
          anyOf: [ { '$ref': '#/definitions/Entry' } ] },
       data: {},
       children:
        [ { keyword: 'instanceof',
            dataPath: '.entry',
            schemaPath: '#/definitions/EntryDynamic/instanceof',
            params: { keyword: 'instanceof' },
            message: 'should pass "instanceof" keyword validation',
            schema: 'Function',
            parentSchema:
             { description:
                'A Function returning an entry object, an entry string, an entry array or a promise to these things.',
               instanceof: 'Function',
               tsType: '(() => EntryStatic | Promise<EntryStatic>)' },
            data: {},
            children: undefined },
          { keyword: 'minProperties',
            dataPath: '.entry',
            schemaPath: '#/minProperties',
            params: { limit: 1 },
            message: 'should NOT have fewer than 1 properties',
            schema: 1,
            parentSchema:
             { description:
                'Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.',
               type: 'object',
               additionalProperties:
                { description: 'An entry point with name',
                  oneOf:
                   [ { description:
                        'The string is resolved to a module which is loaded upon startup.',
                       type: 'string',
                       minLength: 1 },
                     { description:
                        'All modules are loaded upon startup. The last one is exported.',
                       anyOf:
                        [ { '$ref': '#/definitions/NonEmptyArrayOfUniqueStringValues' } ] } ] },
               minProperties: 1 },
            data: {},
            children: undefined },
          { keyword: 'type',
            dataPath: '.entry',
            schemaPath: '#/oneOf/0/type',
            params: { type: 'string' },
            message: 'should be string',
            schema: 'string',
            parentSchema:
             { description:
                'An entry point without name. The string is resolved to a module which is loaded upon startup.',
               type: 'string',
               minLength: 1 },
            data: {},
            children: undefined },
          { keyword: 'type',
            dataPath: '.entry',
            schemaPath: '#/definitions/NonEmptyArrayOfUniqueStringValues/type',
            params: { type: 'array' },
            message: 'should be array',
            schema: 'array',
            parentSchema:
             { type: 'array',
               items:
                { description: 'A non-empty string',
                  type: 'string',
                  minLength: 1 },
               minItems: 1,
               uniqueItems: true },
            data: {},
            children: undefined },
          { keyword: 'anyOf',
            dataPath: '.entry',
            schemaPath: '#/oneOf/1/anyOf',
            params: {},
            message: 'should match some schema in anyOf',
            schema:
             [ { '$ref': '#/definitions/NonEmptyArrayOfUniqueStringValues' } ],
            parentSchema:
             { description:
                'An entry point without name. All modules are loaded upon startup. The last one is exported.',
               anyOf:
                [ { '$ref': '#/definitions/NonEmptyArrayOfUniqueStringValues' } ] },
            data: {},
            children: undefined },
          { keyword: 'oneOf',
            dataPath: '.entry',
            schemaPath: '#/oneOf',
            params: { passingSchemas: null },
            message: 'should match exactly one schema in oneOf',
            schema:
             [ { description:
                  'An entry point without name. The string is resolved to a module which is loaded upon startup.',
                 type: 'string',
                 minLength: 1 },
               { description:
                  'An entry point without name. All modules are loaded upon startup. The last one is exported.',
                 anyOf:
                  [ { '$ref': '#/definitions/NonEmptyArrayOfUniqueStringValues' } ] } ],
            parentSchema:
             { oneOf:
                [ { description:
                     'An entry point without name. The string is resolved to a module which is loaded upon startup.',
                    type: 'string',
                    minLength: 1 },
                  { description:
                     'An entry point without name. All modules are loaded upon startup. The last one is exported.',
                    anyOf:
                     [ { '$ref': '#/definitions/NonEmptyArrayOfUniqueStringValues' } ] } ] },
            data: {},
            children: undefined },
          { keyword: 'oneOf',
            dataPath: '.entry',
            schemaPath: '#/oneOf',
            params: { passingSchemas: null },
            message: 'should match exactly one schema in oneOf',
            schema:
             [ { '$ref': '#/definitions/EntryObject' },
               { '$ref': '#/definitions/EntryItem' } ],
            parentSchema:
             { oneOf:
                [ { '$ref': '#/definitions/EntryObject' },
                  { '$ref': '#/definitions/EntryItem' } ] },
            data: {},
            children: undefined },
          { keyword: 'anyOf',
            dataPath: '.entry',
            schemaPath: '#/anyOf',
            params: {},
            message: 'should match some schema in anyOf',
            schema:
             [ { '$ref': '#/definitions/EntryDynamic' },
               { '$ref': '#/definitions/EntryStatic' } ],
            parentSchema:
             { anyOf:
                [ { '$ref': '#/definitions/EntryDynamic' },
                  { '$ref': '#/definitions/EntryStatic' } ] },
            data: {},
            children: undefined } ] } ] }
error Command failed with exit code 1.

Here is my slate.config.js

/* eslint-disable */

// Configuration file for all things Slate.
// For more information, visit https://github.com/Shopify/slate/wiki/Slate-Configuration

const path = require('path');

module.exports = {
  'network.externalTesting': false,
  'cssVarLoader.liquidPath': ['src/snippets/css-variables.liquid'],
  'webpack.extend': {
    resolve: {
      alias: {
        jquery: path.resolve('./node_modules/jquery'),
        'lodash-es': path.resolve('./node_modules/lodash-es'),
      },
    },
  },
};

and here's my package.json

  "devDependencies": {
    "@shopify/slate-tools": "1.0.0-beta.14",
    "babel-preset-shopify": "^16.2.0",
    "eslint-plugin-shopify": "^19.0.0",
    "stylelint-config-prettier": "^3.0.4",
    "stylelint-config-shopify": "^5.0.0"
  },
  "dependencies": {
    "@shopify/theme-a11y": "^1.0.1",
    "@shopify/theme-cart": "^1.0.0-alpha.7",
    "@shopify/theme-currency": "^1.0.0-alpha.7",
    "@shopify/theme-images": "^1.0.0-alpha.7",
    "@shopify/theme-rte": "^1.0.0-alpha.7",
    "@shopify/theme-sections": "^1.1.0",
    "@shopify/theme-variants": "^1.0.0-alpha.8",
    "chart.js": "^2.7.3",
    "jquery": "^3.2.1",
    "jquery-serializejson": "^2.8.1",
    "lazysizes": "^4.1.1",
    "lodash-es": "^4.17.4",
    "normalize-scss": "^7.0.1",
    "normalize.css": "^7.0.0",
    "rivets": "^0.9.6",
    "shopify-cartjs": "^0.4.1",
    "sightglass": "^0.2.6"
  },
  "scripts": {
    "start": "slate-tools start",
    "watch": "slate-tools start --skipFirstDeploy",
    "build": "slate-tools build",
    "deploy": "slate-tools build && slate-tools deploy --env=production",
    "zip": "slate-tools build && slate-tools zip",
    "lint": "slate-tools lint",
    "format": "slate-tools format"
  }
}
jonathanmoore commented 5 years ago

Take a look at the breaking changes in Slate beta12. beta12 changed how assets are organized and will require you to move some things around. When I upgraded a while back I built a new slate theme in a separate directory to see exactly how things where organized. https://github.com/Shopify/slate/releases

skillmatic-co commented 5 years ago

Having the same issue. My file structure has been update as noted in @jonathanmoore's comment above, still throwing the same error on yarn start.