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

CLI behavior incorrectly invoked by importing ecstatic in ES modules #226

Closed
xiata opened this issue Aug 14, 2018 · 6 comments · Fixed by #242
Closed

CLI behavior incorrectly invoked by importing ecstatic in ES modules #226

xiata opened this issue Aug 14, 2018 · 6 comments · Fixed by #242

Comments

@xiata
Copy link

xiata commented Aug 14, 2018

Importing a module should not trigger the CLI.
This is due to module.parent being null from imports into ES modules.

node: 10.8.0

node --experimental-modules example.mjs

example.mjs:

import ecstatic from 'ecstatic';
console.log(ecstatic);

Console:

ecstatic serving ... at http://0.0.0.0:8000
(and the typical log from console logging a constructor)
@jfhbrook
Copy link
Owner

ugh.

I have no interest in explicitly supporting experimental features (I think es modules are kinda dumb if I can be real) but feel free to submit a pull request.

@jfhbrook
Copy link
Owner

most likely the move is to just factor that code out into a cli.js and update npm accordingly. Relatively straightforward, I'm just lazy.

@xiata
Copy link
Author

xiata commented Aug 14, 2018

Was about to write up that suggestion, I'll try to get around to it this weekend

@jfhbrook
Copy link
Owner

Sounds good!

@jfhbrook
Copy link
Owner

jfhbrook commented Apr 5, 2019

Should be fixed by #242

jfhbrook added a commit that referenced this issue Apr 5, 2019
Move bin behavior out of lib/ecstatic.js, fix #226
@jfhbrook
Copy link
Owner

jfhbrook commented Apr 5, 2019

Fixed in 4.0.0

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

Successfully merging a pull request may close this issue.

2 participants