Skip to content

npm run build fails on master branch #2786

Description

@anthonysena

Expected behavior

Running npm run build works without failure

Actual behavior

Running npm run build on the code currently on master produces the following error:

PS C:\git\OHDSI\Atlas> npm run build

> [email protected] build
> npm run prep && npm run build:dev


> [email protected] prep
> npm i && npm run clean && npm run genversion


up to date, audited 419 packages in 3s

2 packages are looking for funding
  run `npm fund` for details

32 vulnerabilities (1 low, 12 moderate, 15 high, 4 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

> [email protected] clean
> rimraf ./js/assets/bundle && rimraf ./js/assets/fonts && rimraf ./js/assets/images


> [email protected] genversion
> genversion -s js/version/version.js && r_js -convert js/version js/ && rimraf js/version


> [email protected] build:dev
> node build/optimize.js && npm run compress

Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
[BABEL] Note: The code generator has deoptimised the styling of undefined as it exceeds the max of 500KB.
Error: SyntaxError: unknown: Support for the experimental syntax 'optionalChaining' isn't currently enabled (18:61):

  16 |                                                  self.VisitSourceConcept()(null);
  17 |                                          }
> 18 |                                          if (ko.utils.unwrapObservable(self.VisitDetailTypeCS()?.CodesetId) == change.value.id) {
     |                                                                                                ^
  19 |                                                  self.VisitDetailTypeCS(new ConceptSetSelection());
  20 |                                          }
  21 |                                          if (ko.utils.unwrapObservable(self.GenderCS()?.CodesetId) == change.value.id) {

Add @babel/plugin-proposal-optional-chaining (https://git.io/vb4Sk) to the 'plugins' section of your Babel config to enable transformation.
In module tree:
    main
      pages/Router
        pages/main
          pages/cohort-definitions/index
            pages/cohort-definitions/routes
              pages/cohort-definitions/cohort-definition-manager
                components/cohortbuilder/CohortDefinition
                  components/cohortbuilder/CohortExpression
                    components/cohortbuilder/CriteriaGroup
                      components/cohortbuilder/AdditionalCriteria
                        components/cohortbuilder/WindowedCriteria
                          components/cohortbuilder/CriteriaTypes

    at Parser.raise (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:3831:17)

    at C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:28332:19
    at C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:3059:39
    at C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:2999:25
    at Function.prim.nextTick (C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:28083:9)
    at Object.errback (C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:2998:26)
    at Object.callback (C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:2984:23)
    at Object.then (C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:3038:23)
    at build (C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:28289:12)
    at runBuild (C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:30302:17)
    at Object.execCb (C:\git\OHDSI\Atlas\node_modules\requirejs\bin\r.js:1946:33) {
  originalError: SyntaxError: unknown: Support for the experimental syntax 'optionalChaining' isn't currently enabled (18:61):

    16 |                                                        self.VisitSourceConcept()(null);
    17 |                                                }
  > 18 |                                                if (ko.utils.unwrapObservable(self.VisitDetailTypeCS()?.CodesetId) == change.value.id) {
       |                                                                                                      ^
    19 |                                                        self.VisitDetailTypeCS(new ConceptSetSelection());
    20 |                                                }
    21 |                                                if (ko.utils.unwrapObservable(self.GenderCS()?.CodesetId) == change.value.id) {

  Add @babel/plugin-proposal-optional-chaining (https://git.io/vb4Sk) to the 'plugins' section of your Babel config to enable transformation.
      at Parser.raise (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:3831:17)
      at Parser.expectPlugin (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:5148:18)
      at Parser.parseSubscript (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:5896:12)
      at Parser.parseSubscripts (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:5882:19)
      at Parser.parseExprSubscripts (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:5872:17)
      at Parser.parseMaybeUnary (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:5842:21)
      at Parser.parseExprOps (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:5729:23)
      at Parser.parseMaybeConditional (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:5702:23)
      at Parser.parseMaybeAssign (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:5647:21)
      at Parser.parseExprListItem (C:\git\OHDSI\Atlas\node_modules\@babel\parser\lib\index.js:6940:18) {
    pos: 906,
    loc: Position { line: 18, column: 60 },
    missingPlugin: [ 'optionalChaining' ],
    code: 'BABEL_PARSE_ERROR',
    fileName: 'C:/git/OHDSI/Atlas/js/components/cohortbuilder/CriteriaTypes/VisitDetail.js',
    moduleTree: [
      'components/cohortbuilder/CriteriaTypes',
      'components/cohortbuilder/WindowedCriteria',
      'components/cohortbuilder/AdditionalCriteria',
      'components/cohortbuilder/CriteriaGroup',
      'components/cohortbuilder/CohortExpression',
      'components/cohortbuilder/CohortDefinition',
      'pages/cohort-definitions/cohort-definition-manager',
      'pages/cohort-definitions/routes',
      'pages/main',
      'pages/Router',
      'main'
    ]
  }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions