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

Compatibility with node.js #257

Closed
tylerlong opened this issue Nov 14, 2015 · 4 comments
Closed

Compatibility with node.js #257

tylerlong opened this issue Nov 14, 2015 · 4 comments

Comments

@tylerlong
Copy link
Collaborator

I first installed mermaid via npm install mermaid
Then I created index.temp.js with only one line: require('mermaid');

It doesn't work for me:

$ node index.temp.js 
/some-path/node_modules/mermaid/src/mermaid.js:19
import * as Logger from './logger';
^^^^^^

SyntaxError: Unexpected token import
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:404:25)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/tylerlong/src/js/markdown-core/index.temp.js:1:63)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
@tylerlong tylerlong changed the title Compatibility with npm Compatibility with node.js Nov 14, 2015
@knsv
Copy link
Collaborator

knsv commented Nov 14, 2015

I am using es2015 features. The pre-compiled libraries have been transformed to ecmascript5 via babel.

If you use require directly you need to apply babel yourself.

This has caused me some headache and I am thinking of rolling back to not use es2015 yet. Still deciding though.

knsv added a commit that referenced this issue Nov 15, 2015
@knsv knsv added the Fixed label Nov 15, 2015
@knsv
Copy link
Collaborator

knsv commented Nov 22, 2015

Closing issue as it's resolution is included in release 0.5.6. Let me know if you do not agree.

@knsv knsv closed this as completed Nov 22, 2015
@tylerlong
Copy link
Collaborator Author

👍 I will have a try. If I don't respond, then it means I find no problem.

Thank you for your work!

@tylerlong
Copy link
Collaborator Author

It works with node.js now.

But it still depends on browser, you cannot do it purely in node.js.

I found this todo in code: https://github.com/knsv/mermaid/blob/master/src/mermaidAPI.js#L486

I will create a separate issue for this.

mgenereu pushed a commit to mgenereu/mermaid that referenced this issue Jun 25, 2022
…yarn/develop/lint-staged-11.0.1

Bump lint-staged from 11.0.0 to 11.0.1
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

2 participants