korzio / djv

Dynamic JSON Schema Validator - Supports draft-04/06

Home Page:https://www.npmjs.com/package/djv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Module entry point

damon-kreft opened this issue · comments

Hey @korzio,

Thanks for the latest release.

We've noticed when optimising a build for production and running everything through UglifyJS (this is a Webpack based build) that UglifyJS throws and error because it is coming across ES6 code in djv, which it of course doesn't understand.

Currently, I'm having to transpile it to ES5 explicitly in my project - https://github.com/operation-orange/analytics-datalayer/blob/master/webpack.config.js#L37

It looks like this is because you are pointing to ./lib/djv.js in your package.json file which is the raw ES6 src. Should it now be pointing to your already transpiled ./djv.js file?

Thanks :)

Hi @damon-kreft
It was intentionally done like that - djv/lib/djv.js is a "nodejs version" - not transpiled, just a raw code. But you are right, a djv/djv.js version is already transpiled and uglified, so I guess you could use it for your build by including the validator with a custom path smth like require('djv/djv.js'). Does it solve your case?

Closed. I think @damon-kreft has found a workaround