Extension crashes when using bundled html-validate
The bundled html-validate
is used when a project with a local copy and configuration is used. The issue is webpack not including elements/html5.json
in the compiled bundle. At a first glance it should be easy to include but until html-validate#79 (closed) is resolved it probably isn't without resorting to hack.
This previously only worked because Config
used fs.readFile(..)
to load the file from disk (and was kept intact by webpack). However, because javascript files can also be loaded it was changed to require(..)
and thus broke this extension as now webpack will transform it to use it's internal require not containing elements/*.json
.
Webpack has support for dynamic require but it would require changes in the upstream library, I think.
Options
- Somehow manage to instruct webpack to include the files in the bundle.
- Overload the configuration, replacing
extends: ["html5"]
withextends: [require("html-validate/elements/html5.json"]
to avoid trying to load from file insidehtml-validate
. - Stop using webpack to bundle
- Implement #2 (closed) (similar to other similar extensions, probably because it is hard to bundle like this)