diff --git a/lib/standalone.js b/lib/standalone.js index 0abaa2cd..a3f705ea 100644 --- a/lib/standalone.js +++ b/lib/standalone.js @@ -3,6 +3,7 @@ function buildStandaloneCode (contextFunc, context, serializer, validator) { let ajvDependencyCode = '' if (context.validatorSchemasIds.size > 0) { + ajvDependencyCode += 'const Validator = require(\'fast-json-stringify/lib/validator\')\n' ajvDependencyCode += `const validatorState = ${JSON.stringify(validator.getState())}\n` ajvDependencyCode += 'const validator = Validator.restoreFromState(validatorState)\n' } else { @@ -11,10 +12,8 @@ function buildStandaloneCode (contextFunc, context, serializer, validator) { return ` 'use strict' - const { dependencies } = require('fast-json-stringify/lib/standalone') - - const { Serializer, Validator } = dependencies + const Serializer = require('fast-json-stringify/lib/serializer') const serializerState = ${JSON.stringify(serializer.getState())} const serializer = Serializer.restoreFromState(serializerState)