Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Bower and handling of external dependencies#13

Merged
guybedford merged 1 commit intoModuleLoader:masterfrom
passy:bower
Jul 30, 2013
Merged

Bower and handling of external dependencies#13
guybedford merged 1 commit intoModuleLoader:masterfrom
passy:bower

Conversation

@passy
Copy link
Copy Markdown
Contributor

@passy passy commented Jul 4, 2013

I think it's worth discussing how es6-module-loader should handle the esprima dependency when installed via a package manager. Since esprima is loaded lazily and the loader expects it in a certain place, it should be included in the package. Vendoring external dependencies, however, is nonoptimal when using package managers.

I attached a sample bower.json that excludes the bundled esprima version and lists it as dependency. How would you like to handle this?

@guybedford
Copy link
Copy Markdown
Member

Good point... one way might be to use a data attribute on the script tag to set the esprima location, for example:

  <script src="es6-module-loader.js" data-esprima-src="/js/esprima/esprima.js"></script>

I like the default behaviour of loading from the same folder though. Any other suggestions welcome.

@sindresorhus
Copy link
Copy Markdown
Contributor

@passy Hah, I was just going to submit this.

@addyosmani
Copy link
Copy Markdown
Member

Were there any oppositions to the suggestion @guybedford made about using data attribs. for the esprima location? any alternative suggestions?.

@sindresorhus
Copy link
Copy Markdown
Contributor

Looks like a good solution too me. Can't come up with anything else.

@passy
Copy link
Copy Markdown
Contributor Author

passy commented Jul 26, 2013

I like the solution, too. +1

guybedford added a commit that referenced this pull request Jul 30, 2013
Bower and handling of external dependencies
@guybedford guybedford merged commit 1a784dd into ModuleLoader:master Jul 30, 2013
@guybedford
Copy link
Copy Markdown
Member

The only issue with the data attribute method is that it is impossible for another script to then inform the esprima location.

Rather I've included a check for the esprimaSrc global variable in this case.

Thus one would write:

  <script>esprimaSrc='bower_components/esprima-harmony/esprima.js'</script>
  <script src="es6-module-loader.js"></script>

@sindresorhus
Copy link
Copy Markdown
Contributor

The only issue with the data attribute method is that it is impossible for another script to then inform the esprima location.

How so?

Rather I've included a check for the esprimaSrc global variable in this case.

Yuk, global...

guybedford added a commit that referenced this pull request Jul 30, 2013
@guybedford
Copy link
Copy Markdown
Member

Ok sure...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants