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

Error when loading .bootstraprc with missing scripts section #152

Closed
kylekampy opened this issue Aug 30, 2016 · 4 comments
Closed

Error when loading .bootstraprc with missing scripts section #152

kylekampy opened this issue Aug 30, 2016 · 4 comments

Comments

@kylekampy
Copy link

Hello!

With the release of 1.1.2, I've encountered an issue loading my .bootstraprc file unless I include an empty scripts section. I haven't had a need for the scripts section and only had a styles section. It does not seem to matter if the config is json or yaml.

An example of my offending config:

{
  "bootstrapVersion": 3,
  "preBootstrapCustomizations": "./styles/_variables.scss",
  "appStyles": "./styles/_bootswatch.scss",
  "styleLoaders": [
    "style",
    "css",
    "sass"
  ],
  "env": {
    "development": {
      "extractStyles": false
    },
    "production": {
      "extractStyles": true
    }
  },
  "styles": {
    "mixins": true,
    "normalize": true,
    "print": true,
    "scaffolding": true,
    "type": true,
    "code": true,
    "grid": true,
    "tables": true,
    "forms": true,
    "buttons": true
  }
}

And the corresponding working version:

{
  "bootstrapVersion": 3,
  "preBootstrapCustomizations": "./styles/_variables.scss",
  "appStyles": "./styles/_bootswatch.scss",
  "styleLoaders": [
    "style",
    "css",
    "sass"
  ],
  "env": {
    "development": {
      "extractStyles": false
    },
    "production": {
      "extractStyles": true
    }
  },
  "styles": {
    "mixins": true,
    "normalize": true,
    "print": true,
    "scaffolding": true,
    "type": true,
    "code": true,
    "grid": true,
    "tables": true,
    "forms": true,
    "buttons": true
  },
  "scripts": {}
}

Note the empty scripts section.

The stack trace from the bad config:

Error: ./~/bootstrap-loader/lib/bootstrap.loader.js!./~/bootstrap-loader/no-op.js
Module build failed: TypeError: Cannot convert undefined or null to object
    at Function.keys (native)
    at exports.default (/home/ubuntu/fons-app/node_modules/bootstrap-loader/lib/utils/selectModules.js:14:17)
    at createConfig (/home/ubuntu/fons-app/node_modules/bootstrap-loader/lib/bootstrap.config.js:125:44)
    at Object.module.exports.pitch (/home/ubuntu/fons-app/node_modules/bootstrap-loader/lib/bootstrap.loader.js:100:40)
 @ ./~/bootstrap-loader/loader.js 1:0-44

So the thing that is undefined or null is the scripts section of the config, and then it tries to do Object.keys on that, which obviously fails.

Let me know if you need more information! Thanks for creating such an awesome module!

@justin808
Copy link
Member

@kkamperschroer Can you please try 1.1.3?

@justin808
Copy link
Member

See #154.

@justin808
Copy link
Member

Please confirm this is fixed in 1.1.4.

@kylekampy
Copy link
Author

Looks like it is fixed in 1.1.4. Thank you!

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