Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm package broken #77

Closed
leider opened this issue Sep 3, 2018 · 6 comments
Closed

npm package broken #77

leider opened this issue Sep 3, 2018 · 6 comments

Comments

@leider
Copy link

leider commented Sep 3, 2018

Describe the bug
The current npm release exposes a typescript class not a javascript class

To Reproduce
Steps to reproduce the behavior:

  1. Create a pure javascript nodejs file
  2. require feed
  3. try to instantiate the Feed class
  4. See error

Expected behavior
Works as before

Actual behavior
Kills server

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • NodeJS: 10
  • TypeScript: none
  • npm/yarn: 5.6.0 (npm)
  • feed: latest

Additional context
None

@jpmonette
Copy link
Owner

@leider Can you provide code sample please?

@leider
Copy link
Author

leider commented Sep 10, 2018 via email

@jpmonette
Copy link
Owner

jpmonette commented Sep 10, 2018

@leider There's no such thing as a TypeScript class - the code is compiled to JavaScript in the lib directory by tsc.

My assumption here (without the code sample you are trying to run) is that you are trying to import the module using a require() instead of an import.

Considering the latest version of feed is now using named imports using the ES6 module syntax, you must import the module as described in the README:

import { Feed } from 'feed';

If you want to stick with the old approach, you should be able to do the following:

const Feed = require('feed').Feed;

As I'm not sure if this was the situation you were facing, please confirm if this solves your issue.

@leider
Copy link
Author

leider commented Sep 11, 2018 via email

@leider
Copy link
Author

leider commented Sep 13, 2018

Checked it. Thanks for the clarification. Problem was me not understanding excatly what was the problem. Documentation fix is appreciated!

@leider leider closed this as completed Sep 13, 2018
@melroy89
Copy link

const Feed = require('feed').Feed; line saved me 2 hours of my day. Please document this !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants