Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
waynehoover opened this issue Apr 9, 2018 · 1 comment
Open

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

waynehoover opened this issue Apr 9, 2018 · 1 comment

Comments

@waynehoover
Copy link

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' }```
@jescalan
Copy link
Member

If you remove spike-optimize, does it work? Can you narrow down the issue a liiitle bit more?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants