Module naming and declarations

Domenic Denicola domenic at domenicdenicola.com
Wed May 8 11:22:08 PDT 2013


From: samth0 at gmail.com [samth0 at gmail.com] on behalf of Sam Tobin-Hochstadt [samth at ccs.neu.edu]

> In contrast, usually you want to be using that global version of "backbone", not something specific to your library.  Of course, you can bundle backbone, and refer to it with "./backbone" if that's what you want, but that's probably a less-common case.

OK! So, this is the confusion. Because the semantics you gave resolve `"backbone"` to a specific URL, `"http://example.com/path/to/base/backbone.js"`. To me that doesn't correspond at all to "the global version of Backbone". Unless I guess you are assuming projects are set up such that their root directory contains a bunch of main module files for all the packages they use? So a web dev's workflow is something like


```
index.html
backbone.js
chai.js
rsvp.js
lib/
  entry.js
  otherModule.js
packages/
  backbone/
    backbone.js
    README.md
    package.json
  chai/
    index.js
    ... lots of other JS files
    package.json
  rsvp/
    index.js
    promise.js
    ... lots of other JS files
    package.json
```

And the root `rsvp.js` contains

```js
import { resolve, Promise, ... } from "packages/rsvp/index"; // or "./packages/rsvp/index"
export { resolve, Promise, ... }
```

I guess a tool would be needed to generate all these delegating files that live in your root directory?

Was that the intent of the way your algorithm resolves `"backbone"`, to move web devs toward such a structure?




More information about the es-discuss mailing list