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.

Not working for typescript

See original GitHub issue

Actually the problem is not with typescript - the problem is with rollup.

https://unpkg.com/memoize-one@4.0.2/dist/memoize-one.cjs.js contains

module.exports = index;

which should be imported as import * as memoizeOne

while https://unpkg.com/memoize-one@4.0.2/dist/memoize-one.esm.js contains

export default index;

which should be imported as import memoizeOne

Result - the code for nodejs (~jest) require one behaviour, while the code for webpack(uses esm bundle) requires another.

It is not a problem for js/flow, as long babel is doing some around magic default imports, but typescript is quite strict about it.

The cjs bundle should match esm bundle.

(and fixing this would introduce a breaking change)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:88 (58 by maintainers)

github_iconTop GitHub Comments

13reactions
alexreardoncommented, Nov 26, 2019

I’m happy to add a named export if it is easier for people

4reactions
TrySoundcommented, Oct 22, 2018

Well another option is named only exports.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript compiler (tsc) command not working with tsconfig
this is the problem: C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\tsc.exe C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\tsc.js.
Read more >
Common TypeScript module problems and how to solve them
Common TypeScript module problems and how to solve them · Introduction · Problem 1: Irregular location of dependencies · Solution 1: Locate the ......
Read more >
How to set up TypeScript
The Manage NuGet Packages window (which you can get to by right-clicking on a project node) · The Nuget Package Manager Console (found...
Read more >
Awaited on typescript 4.5.5 not working · Issue #47803 - GitHub
Bug Report. I've installed: "typescript": "^4.5.5". try to use Awaited type, but vscode writes: Cannot find name 'Awaited'.ts(2304).
Read more >
Typescript intellisense not working in VS 2019
> If your TypeScript version is less than 3.1, please Disable dedicated syntax process under Tools > Options > Text Editor > JavaScript/TypeScript...
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