Skip to content

Fix compatibility with create-react-app@4 #1529

@davidyuk

Description

@davidyuk

Recently I find out that api generated by autorest can't be build in create-react-app@4 with error:

Failed to compile.

./node_modules/@aeternity/aepp-sdk/es/apis/node/node.mjs
Can't import the named export 'ServiceClient' from non EcmaScript module (only default export is available)

node.mjs contains

import * as coreClient from "@azure/core-client";

As a workaround I made a patch https://github.com/aeternity/babel-plugin-transform-default-named-imports/commit/a4a149b1473114dacc29ec939d98bfa388117e88 to babel-plugin-transform-default-named-imports that rewrites it to:

import coreClient from "@azure/core-client";

The oridinal issue probably because azure packages doesn't formatted properly to work in this case (have mjs file extension or type: module in package.json).

Also, would be nice if babel-plugin-transform-default-named-imports supports rewriting a namespace import to a default one (as I implemented in my patch).

I'm asking @subhod-i to investigate this and to send a PR to the babel plugin and to open an issue in one of autorest repos.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions