Skip to content

yarn build failed for Javascript setup with error "Unrecognized Token" #1427

@hemantbaxi

Description

@hemantbaxi

Bug Report

With perspective master branch, it builds fine in python setup but failing to build in Javascript setup with following error:

Steps to Reproduce:

  1. Clone the master branch from github
  2. select Javascript setup
  3. yarn build ... I did get some other errors before getting to this which were because of missing dependencies and got fixed after I installed them.

Expected Result:

Build to work fine.

Actual Result:

$ babel src/js --source-maps --out-dir dist/esm
SyntaxError: src/js/api/client.js: Unexpected token (61:83)
  59 |                 this.send(msg);
  60 | 
> 61 |                 if ((msg.cmd === "table" || msg.cmd === "view") && !this._features?.wait_for_response && resolve) {
     |                                                                                    ^
  62 |                     resolve();
  63 |                 }
  64 |             });
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build:babel:esm" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! yarn build exited 1 in '@finos/perspective'
lerna ERR! yarn build exited 1 in '@finos/perspective'

After doing google search, it seems this is babel optional-chaining feature which webpack is not recognizing. I checked
I have @babel/preset-env plugin. These are the versions of babel and webpack on my system

axihemant@hb-finos:~/finos/perspective$ npm list webpack
/home/baxihemant/finos/perspective
└── webpack@4.46.0

baxihemant@hb-finos:~/finos/perspective$ npm list babel
/home/baxihemant/finos/perspective
└── babel@6.23.0

baxihemant@hb-finos:~/finos/perspective$ npm list babel-cli
/home/baxihemant/finos/perspective
└── babel-cli@6.26.0

baxihemant@hb-finos:~/finos/perspective$ npm list @babel/preset-env
/home/baxihemant/finos/perspective
└── @babel/preset-env@7.14.2

Environment:

master branch
OS : Ubuntu 20.10
npm -v
6.14.8
Virtualized environment

Thanks,
Hemant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions