Skip to content

TypeError: Cannot read property 'type' of undefined #2

@waynehoover

Description

@waynehoover

Getting this error when trying to compile: TypeError: Cannot read property 'type' of undefined

My details:

Standard app.production.js setup from spike -new

const optimize = require('spike-optimize')

module.exports = {
  devtool: false,
  afterSpikePlugins: [...optimize({
    scopeHoisting: true,
    aggressiveSplitting: true,
    minify: true
  })]
}

My app.js has a couple edits:

const htmlStandards = require('reshape-standard')
const cssStandards = require('spike-css-standards')
const jsStandards = require('spike-js-standards')
const markdown = require('reshape-markdown')
const pageId = require('spike-page-id')
const Records = require('spike-records')
const sugarml = require('sugarml')
const sugarss = require('sugarss')
const md = require('markdown-it')
const env = process.env.SPIKE_ENV
const locals = {}
const records = new Records({
  addDataTo: locals,
  posts: {
    url: 'aurlhere.com/json.json',
    template: {
      transform: (data) => { return data.items },
      path: 'views/post.sgr',
      output: (post) => { return `/posts/${post.fields.slug}.html` }
    }
  }
})

module.exports = {
  devtool: 'source-map',
  matchers: { html: '*(**/)*.sgr', css: '*(**/)*.sss' },
  ignore: ['**/layout.sgr', '**/_*', '**/.*', 'readme.md', 'yarn.lock', 'package-lock.json'],
  reshape: htmlStandards({
    parser: sugarml,
    locals: (ctx) => Object.assign(locals, {pageId: pageId(ctx), md: md()}),
    minify: env === 'production',
    parserRules: [
      { test: /\.md$/, parser: markdown() }
    ]
  }),
  plugins: [records],
  postcss: cssStandards({
    parser: sugarss,
    minify: env === 'production',
    warnForDuplicates: env !== 'production',
    appendPlugins: [require('lost')]
  }),
  babel: jsStandards()
}

The full stacktrace

❯ spike compile -e production
Node#moveTo was deprecated. Use Container#append.
✗ ERROR
{ TypeError: Cannot read property 'type' of undefined
    at when.reduce (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/reshape-plugin-util/lib/index.js:12:14)
    at tryCatchResolve (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/when/lib/apply.js:46:23)
    at callAndResolve (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/when/lib/apply.js:30:12)
    at callAndResolveNext (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/when/lib/apply.js:40:4)
    at Fold.fulfilled (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/when/lib/makePromise.js:767:11)
    at tryCatchReject (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/when/lib/makePromise.js:845:30)
    at runContinuation1 (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/when/lib/makePromise.js:804:4)
    at Fulfilled.when (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/when/lib/makePromise.js:592:4)
    at ContinuationTask.run (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/when/lib/makePromise.js:702:24)
    at Scheduler._drain (/Users/wayne/Sites/wh2/waynehoovercom/node_modules/when/lib/Scheduler.js:62:19) id: 'c32c367a' }```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions