question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't import the named export 'RestError' from non EcmaScript module (only default export is available)

See original GitHub issue

Describe the bug Trying to perform import { RestError } from '@azure/core-rest-pipeline'; in a ECMAScript Module file (.mjs).

returns build error with the message Can't import the named export 'RestError' from non EcmaScript module (only default export is available)

To Reproduce Steps to reproduce the behavior: I have created a simple project to demonstrate this

  1. git clone git@github.com:subhod-i/react-app-4.git
  2. cd react-app-4
  3. npm i
  4. npm start

Expected behavior Support for ECMA module files.

Additional context The same problem is observed in @azure/core-client package too.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
jeremymengcommented, Aug 5, 2022

@subhod-i I tested the scenario and PR #22804 appears to have addressed the issue. Will continue working on getting it merged.

0reactions
jeremymengcommented, Oct 20, 2022

webpack@4 has a quirk, but it is doable to fix this on the side of your package, e.g. using mjs extension or adding "type": "module" to package.json

@davidyuk I added "type": "module" in PR #22804. However, the repro project now gives another error as mentioned above. I am still trying to figure out whether there’s anything I can do to fix that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask Question - Stack Overflow
TypeError: undefined is not an object (evaluating ... Allow 'import x from y' when a module doesn't have a default export.
Read more >
Error when importing document attachments - Kentico DevNet
The scheduler feature used only the main domain name and presentation URL of a site when attempting to process scheduled tasks in local...
Read more >
21.03 - Teradici
Licensed under the MIT license.export { AzureKeyCredential } from ". ... Provides a default {@link ChainedTokenCredential} configuration for * applications ...
Read more >
2019-October.txt - NGINX mailing list
This can be only done when there are no data in SSL buffers, and there is no ... 15 Aug 2019 + Core:...
Read more >
US20210373860A1 - Intent compiler - Google Patents
In contrast, a non-secure friendly chat application would use a default transmission ... service.json, exports.json, imports.json, enums.json, classes.json, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found