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

how to import not require #840

Closed
shaunthegeek opened this issue Jan 6, 2017 · 8 comments
Closed

how to import not require #840

shaunthegeek opened this issue Jan 6, 2017 · 8 comments

Comments

@shaunthegeek
Copy link

import marked from 'marked';

return (<div>{ marked('I am using __markdown__.') }</div>);

error:

TypeError: src.replace is not a function
Please report this to https://github.com/chjj/marked
@sciborrudnicki
Copy link

sciborrudnicki commented Aug 3, 2017

As i see it works when you add
npm install @types/marked
then

import 'marked';

marked('**bold**);

@ondrejsevcik
Copy link

Isn't this valid just for typescript?

@sciborrudnicki
Copy link

sciborrudnicki commented Oct 25, 2017

@ondrejsevcik it is, because of @types/marked.

@ondrejsevcik
Copy link

@chjj Would you accept PR solving this issue? I think it's a good time to start support import syntax.

@anowell
Copy link

anowell commented Oct 27, 2017

fwiw, I was tripping over this until doing

import * as marked from 'marked';
console.log(marked('## foo'));

@ondrejsevcik
Copy link

@anowell unfortunately that doesn't work for me (I'm using it in Ember app).

@joshbruce
Copy link
Member

@ondrejsevcik: I can say, we would definitely consider it. Having said that, focus right now is still security and fixing known failings we have with markdown specs; so, we may not be triaging tickets as much as you might think necessary.

If the solution can make import work without destroying require...don't see why we wouldn't at least have a healthy discussion around it.

@joshbruce
Copy link
Member

See also #1106

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

No branches or pull requests

5 participants