Skip to content

errors with zero options #1

@wkentdag

Description

@wkentdag

description

given the following config file:

//index.js

const reshape = require('reshape')
const sugarml = require('sugarml')
const htmlStandards = require('spike-html-standards')
const {readFileSync} = require('fs')

reshape({
  plugins: htmlStandards()
  // parser: sugarml
})
.process(readFileSync('./index.sml', 'utf8'))
.then(result => {
  console.log(result.output())

})
.catch(console.error)

and the following index.sml file:

html
  body
    .first-level
      .second-level
        .third-level hi!
      .second-level-2

I get this error:

⚡ iiif-viewer@master ~ node index.js 
/Users/wkentdaggett/local-dev/iiif-viewer/node_modules/spike-html-standards/lib/index.js:12
  if (options.webpack) {
             ^

TypeError: Cannot read property 'webpack' of undefined
    at spikeHtmlStandards (/Users/wkentdaggett/local-dev/iiif-viewer/node_modules/spike-html-standards/lib/index.js:12:14)
    at Object.<anonymous> (/Users/wkentdaggett/local-dev/iiif-viewer/index.js:8:12)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:160:18)
    at node.js:449:3

Adding a default value for options here (or passing an empty object to the constructor) got rid of the error, but the resulting output was still unprocessed sml. When I pass {parser: sugarml} to reshape instead of {plugins: htmlStandards()} I get the desired result, so I'm fairly confident this is an issue with this library's config and not something else in my code. If my example is missing some required options, IMO the readme could use a clearer example of the minimum config necessary to use this plugin with reshape.

environment

node 6.2.0
npm 3.10.6
reshape 0.3.2
spike-html-standards 0.2.1
sugarml: 0.2.2

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