Errors while running project for first time

Hey all,

I’ve installed @jsonforms/core": "^3.0.0-alpha.1 into my project along with:
“ajv”: “^8.10.0”,
“ajv-errors”: “^3.0.0”. When trying to run my project I get the following error:

Error: ./node_modules/@jsonforms/core/lib/jsonforms-core.esm.js 378:22
Module parse failed: Unexpected token (378:22)
File was processed with these loaders:

  • ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js

  • ./node_modules/@ngtools/webpack/src/ivy/index.js
    You may need an additional loader to handle the result of these loaders.

    if (state.ajv) {
    return action?.schema
    ? reuseAjvForSchema(state.ajv, action.schema)
    : state.ajv;
    Any idea what’s going on here? I’ve tried to downgrade to version 2.5, but then I get a json parser error when trying to run. I’m running on angular 11.

Thanks

Hi!

We release our libs as ESM modules targeting the latest JS standard. It seems that your Webpack configuration can’t handle this (i.e. it doesn’t understand the optional chaining ‘?’).

One way of solving this is to add the babel plugins @babel/plugin-proposal-optional-chaining and @babel/plugin-proposal-nullish-coalescing-operator to your build.

Hi @sdirix ,

Thanks for the response. I’ve added both those plugins and I’m still getting the same error. Is there any compatibility issue regarding 3.0.0-alpha.1 and Angular 11? If not, what version is compatible with Angular 11?

Thanks for your time

We updated to Angular 12 in between 3.0.0-alpha.1 and 3.0.0-alpha.2. 3.0.0-alpha.1 was still built against Angular 9. From my understanding 3.0.0-alpha.1 should work fine with Angular 11.

The Babel plugin suggestion is not needed if you’re still using 3.0.0-alpha.1 as the build changes only came later with the first beta.

However looking at your dependencies, you specified ^3.0.0-alpha.1. So you probably are actually using a later version. I would try to pin the version or update to Angular 12.

Thanks for the reply. I’ve changed to 3.0.0-alpha.1 and it is working as expected. Thanks for the help!

1 Like