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

es6-global can't resolve external node modules as URI #2118

Open
yyc-git opened this issue Oct 14, 2017 · 2 comments
Open

es6-global can't resolve external node modules as URI #2118

yyc-git opened this issue Oct 14, 2017 · 2 comments
Labels

Comments

@yyc-git
Copy link

@yyc-git yyc-git commented Oct 14, 2017

build this code:

external createSandbox : unit => Js.t {..} = "create" [@@bs.scope "sandbox"] [@@bs.module "sinon"];

expect to genearte:

import * as Sinon                  from "../../node_modules/sinon";

but actual to generate:

/*
wrong:
 import * as Sinon                  from "sinon"; 
*/

/* fixed */
import * as Sinon  from "../../node_modules/sinon/dist/sinon.js"

refer to #1193:

how to know the path of external JS library, currently we leave it as it
Implementation details:
we might need have a global view of dependencies and pass a package map unlike current implementation which did lots of path calculation

can @bobzhang fix it?

@bobzhang

This comment has been minimized.

Copy link
Member

@bobzhang bobzhang commented Oct 14, 2017

what's your motivation here?
note your third party js dependency probably does not work with browser out of box (even with es6 module support). for example, in browser, you have to write from "./xxx.js" instead of from "./xxx"

@yyc-git

This comment has been minimized.

Copy link
Author

@yyc-git yyc-git commented Oct 14, 2017

I want to use es6 module in chrome, so that i don't need to rollup the bundle before run in chrome.

yes, the "expect to generate" is wrong here, the actual expect is like:

import * as Sinon  from "../../node_modules/sinon/dist/sinon.js"; 
/* get "dist/sinon.js" path from sinon->pacakge.json->main field */
@bobzhang bobzhang changed the title es6-global can't resolve external js module es6-global can't resolve external node modules as URI Nov 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.