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.

[BUG] Default import is broken in v3.5.0

See original GitHub issue

Describe the bug As of v3.5.0, When importing as

import csv from 'fast-csv';

and using as

csv.writeToStream(stream, rowsWithHeaders, {
      headers: true,
    });

I get an error at runtime

TypeError: Cannot read property 'writeToStream' of undefined

To fix it, I could import like this :

import * as csv from 'fast-csv';

and everyting works again

To Reproduce Steps to reproduce the behavior:

  1. npm install fast-csv@3.5.0
  2. Here is a failing test (with jest) :
import csv from 'fast-csv';

describe('CSV issue', () => {
  test('should not throw', () => {
    expect(csv).not.toBeUndefined();
  });
});

it fails with :

 FAIL  src/api-admin/application/__tests__/repro.spec.ts
  ● CSV issue › should not throw

    expect(received).not.toBeUndefined()

    Received: undefined

      3 | describe('CSV issue', () => {
      4 |   test('should not throw', () => {
    > 5 |     expect(csv).not.toBeUndefined();
        |                     ^
      6 |   });
      7 | });
      8 | 

      at Object.<anonymous> (src/api-admin/application/__tests__/repro.spec.ts:5:21)

Expected behavior import csv from 'fast-csv'; should still work, or this should be a major version bump as it is possibly breaking callers.

Desktop (please complete the following information):

  • OS: macOS
  • OS Version Mojave 10.14.6
  • Node Version 12.13.1

Additional context I believe the breakage is due to the changes in index.ts in :

https://github.com/C2FO/fast-csv/commit/28472e54e28888892314493aa5913b4b49f0ed52#diff-f41e9d04a45c83f3b6f6e630f10117fe

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
doug-martincommented, Dec 19, 2019

I’ve create #301 to address this.

1reaction
doug-martincommented, Dec 19, 2019

I think documentation is a great place to start!

Ill add a some documentation about that. A longer term change would be to provide ts examples along side the js examples.

Thanks again for pointing this out!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] 5.0 Failed to compile with create-react-app · Issue #1307
[BUG] 5.0 Failed to compile with create-react-app #1307 ... Can't import the named export 'XXX' from non EcmaScript module (only default export is ......
Read more >
Bug: Dynamic imports are broken ☠️ - Site Feedback
Yep. The workaround I have to use currently is replacing all dynamic imports with require('https://bundle.run/...') Sorry, this was my fault! I've deployed a...
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
... Bug:3 - "poedit-1.1.5.ebuild" status:RESOLVED resolution:FIXED severity:normal ... Bug:106 - "dircolors is not useable with zsh, and may be broken" ...
Read more >
[UE5] Nanite bugged in new version of UE5?
Hi, I updated Unreal to the latest github repo of 5.0. After reimporting my project nanite does not work anymore.
Read more >
Eclipse error: "The import XXX cannot be resolved"
This is still (in v 2020-09) an old (2010) Eclipse bug that can be resolved ... Changing the order back does not regress...
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