javascript - Apparent dynamic imports from ajvdistruntime in vendor.js build from Angular 18 using latest 8.17.1 - Stack Overflo

admin2025-04-18  4

I am using latest version of AJV Ajv JSON schema validator in an Angular 18 project. I have a single file that imports the AJV library, sets up its options and uses it to validate my app's JSON. I can provide more implementation details if needed.

I'm not specifically referencing any ajv/dist/runtime modules but when I build my project, I'm seeing 4 different references that appear to be strings referencing dynamic includes in the vendor.js file.

This is preventing my exported web component from running in Salesforce as a LWC due to the apparent use of dynamic imports:

Here are the references from vendor.js:

code: e._'require("ajv/dist/runtime/validation_error").default' }));
e.code = 'require("ajv/dist/runtime/equal").default',
s.code = 'require("ajv/dist/runtime/ucs2length").default'
e.code = 'require("ajv/dist/runtime/uri").default',

Does anyone know if there is a flag I can pass in the options to prevent this or perhaps another workaround? I've tried several mitigation approaches/methods in the angular.json to no avail.

转载请注明原文地址:http://anycun.com/QandA/1744916302a89439.html