bropat / eufy-security-client

This shared library allows to control Eufy security devices by connecting to the Eufy cloud servers and local/remote stations over p2p.
MIT License
480 stars 69 forks source link

[Question]: 2.0.0 fails to compile #148

Closed hauptanja closed 2 years ago

hauptanja commented 2 years ago

Client version

2.0.0

Node version

16.13.2

Operating System type

Mac OS X

Operating system version

macOS big sur 11.1

Describe the bug

I updated my electron - vue js app to the latest version of eufy-security-client and my project now fails to compile.

To reproduce

  1. Change eufy-security-client version in package.json to 2.0.0
  2. rm -rf node_modules
  3. npm i
  4. npm run vue-cli-service electron:serve

Screenshots & Logfiles

ERROR Failed to compile with 5 errors 5:34:19 PM

error in ./node_modules/eufy-security-client/build/http/station.js

Module parse failed: Unexpected token (307:46) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | isIntegratedDevice() { | if (device_1.Device.isLock(this.getDeviceType()) || device_1.Device.isSmartDrop(this.getDeviceType())) {

        return this.rawStation.devices[0]?.device_sn === this.rawStation.station_sn;

| } | return device_1.Device.isWiredDoorbellDual(this.getDeviceType()) || device_1.Device.isFloodLight(this.getDeviceType()) || device_1.Device.isWiredDoorbell(this.getDeviceType()) || device_1.Device.isIndoorCamera(this.getDeviceType()) || device_1.Device.isSoloCameras(this.getDeviceType());

@ ./node_modules/eufy-security-client/build/http/index.js 23:13-33 @ ./node_modules/eufy-security-client/build/index.js @ ./src/camerasUtil.js @ ./src/background.js @ multi ./src/background.js

error in ./node_modules/eufy-security-client/build/p2p/session.js

Module parse failed: Unexpected token (478:127) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | } | else {

            this.log.error(`Station ${this.rawStation.station_sn} - Max retries ${this.messageStates.get(message.sequence)?.retries} - stop with error ${types_1.ErrorCode[message.returnCode]}`, { sequence: message.sequence, commandType: message.commandType, channel: message.channel, retries: message.retries, returnCode: message.returnCode });

| this.emit("command", { | command_type: message.nestedCommandType !== undefined ? message.nestedCommandType : message.commandType,

@ ./node_modules/eufy-security-client/build/p2p/index.js 4:16-36 @ ./node_modules/eufy-security-client/build/index.js @ ./src/camerasUtil.js @ ./src/background.js @ multi ./src/background.js

error in ./node_modules/eufy-security-client/build/eufysecurity.js

Module parse failed: Unexpected token (519:24) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | await this.api.login(options) | .then(async () => {

        if (options?.verifyCode) {

| let trusted = false; | const trusted_devices = await this.api.listTrustDevice();

@ ./node_modules/eufy-security-client/build/index.js 22:13-38 @ ./src/camerasUtil.js @ ./src/background.js @ multi ./src/background.js

error in ./node_modules/eufy-security-client/build/push/service.js

Module parse failed: Unexpected token (588:24) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | this.resetRetryTimeout(); | this.clearCredentialsTimeout();

    this.pushClient?.close();

| } | clearCredentialsTimeout() {

@ ./node_modules/eufy-security-client/build/push/index.js 18:13-33 @ ./node_modules/eufy-security-client/build/index.js @ ./src/camerasUtil.js @ ./src/background.js @ multi ./src/background.js

error in ./node_modules/eufy-security-client/build/http/api.js

Module parse failed: Unexpected token (98:74) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | (options, error, retryCount) => { | // This will be called on retryWithMergedOptions(...)

                    this.log.debug(`Retrying [${retryCount}]: ${error?.code} (${error?.request?.requestUrl})`, { options: options });

| // Retrying [1]: ERR_NON_2XX_3XX_RESPONSE | }

@ ./node_modules/eufy-security-client/build/http/index.js 18:13-29 @ ./node_modules/eufy-security-client/build/index.js @ ./src/camerasUtil.js @ ./src/background.js @ multi ./src/background.js

ERROR Build failed with errors.

Additional context

No response

bropat commented 2 years ago

@hauptanja

Version 2.0.0 switched to target ES2020, before it was ES2019.

bropat commented 2 years ago

It seems that your version of Vuejs does not support optional chaining. I could switch back to target ES2019 if needed.

There is no bug on my side.

bropat commented 2 years ago

Version 2.0.1 switched back to target ES2019