Skip to content

Treat jQuery & Tether as dependencies in ES6 source code #17201

@skrivle

Description

@skrivle

First of all, congrats on the v4 release guys. Looking really nice! I'm especially excited about the new ES6 source code. However, when scanning the source code I noticed that jQuery isn't imported like the other dependencies. Because of this jQuery is also missing in the UMD definitions that are generated via grunt. This causes the UMD modules to be more or less unusable unless you include jQuery globally.

I guess the reason for this is that it's probably difficult to guess how people are going to import jQuery. Import paths and package names may differ between package managers, etc ...

However, since jQuery is the only external dependency here, I think it should be possible. For example you could ask people using requirejs to define a custom path, which they are probably doing already ...

On npm the package for jQuery is 'jquery', so this shouldn't cause any issues. Then the only remaining problem is that babel is converting this:

import $ from 'jquery'

to

factory(mod.exports, mod, global.$);

Which probably will work, but it is kind of risky to use '$' instead of jQuery I guess ... Maybe there is way to hook into babel's compiling step and change module names there ...

Adding jQuery as a dependency will also enable people who are already writing ES6 code to actually import the ES6 code ...

I may be missing a lot of stuff here, so any feedback is more than welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions