Error if "options" is not defined in webpack config
mattacular opened this issue · comments
I am relying on Webpack to replace a var used with the #ifdef statements so don't need to actually pass values through the options. Kind of an edge case, but noticed if options is not provided, get this vague error upon running webpack:
use: [
{ loader: 'babel-loader' },
{ loader: 'ifdef-loader' }, // errors if `options` is not provided
],
TypeError: Cannot read property 'json' of null
Passing empty object fixes it and everything seemingly works as expected:
use: [
{ loader: 'babel-loader' },
{ loader: 'ifdef-loader', options: {} }, // all good
],
Thanks. Very useful plugin!
Ran into this same issue. I've put in a PR to default the options object to an empty object if not provided.