preload-webpack-plugin
preload-webpack-plugin copied to clipboard
Proposed change: validate `rel` option against accepted values in spec and supported values in project
Mind if I submit a function to validate the rel option in the plugin constructor? For values allowed by the spec but not supported by the plugin (e.g. preconnect) it would follow the existing pattern of issuing a console.warn to let the user know they've probably made a mistake, but not break the build as they may have a valid reason for doing this (e.g. using the plugin to test an implementation of preconnect). For values not allowed by the spec, it would follow the existing pattern of issuing a log.error and throwing the same message as an error.
This behavior would be wrapped in a function called in the plugin constructor. For instance, index.js line 30 would be: validateRel(this.options.rel);, coming after the default options are applied so as not to make assumptions about how the supplied value interacts with the default, but rather make an assertion on the option ultimately making it into the build.