Bug Tracker

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#13119 closed bug (fixed)

Make jQuery releases available via npm

Reported by: Rick Waldron Owned by: timmywil
Priority: high Milestone: 2.1
Component: build Version: 2.0.3
Keywords: Cc: isaacs
Blocked by: Blocking:

Description

Recently, Domenic Denicola expressed a need for npm to offer "just jQuery", this due to all the existing jQuery-related packages are jQuery plus something else, which is useless if you want to use npm for client libs as well (which is a valuable use case)

Isaac Schlueter has reached out to the "jquery" and "jQuery" package owners to see if any are willing to give us the name to release jQuery on npm.

TODO:

  1. Update window.jQuery = window.$ = jQuery; to conditionally export to module.exports or window as needed.
  2. Change the reference to window (in #1) to a safe global object reference.
  3. Update jQuery Core Release Management to include an npm publish

Change History (24)

comment:1 Changed 5 years ago by Rick Waldron

Owner: set to Rick Waldron
Status: newassigned

comment:2 Changed 5 years ago by Rick Waldron

Cc: isaacs added
Milestone: None1.9

PR submitted by Isaac Schlueter https://github.com/jquery/jquery/pull/1103

comment:3 Changed 5 years ago by dmethvin

Agreed on the utility. We need some unit tests or other insurance against inadvertent regressions.

comment:4 Changed 5 years ago by Rick Waldron

The current PR will break if there is some other object called module with an exports property. This gist illustrates a bulletproof "node detector": https://gist.github.com/3906504

comment:5 Changed 5 years ago by dmethvin

Component: unfiledbuild
Milestone: 1.92.0
Priority: undecidedhigh

comment:6 Changed 5 years ago by dcherman

Is there a good reason to not expose jQuery/$ as a global when an AMD loader is present like the current PR does? That's a breaking change FWIW.

For comparison, other AMD compatible utilities like Lodash, Hogan.js, and the Backbone/Underscore AMD versions maintained by jrburke still create a global even in the presence of an AMD loader.

comment:7 in reply to:  4 Changed 5 years ago by oost

Replying to rwaldron:

The current PR will break if there is some other object called module with an exports property. This gist illustrates a bulletproof "node detector": https://gist.github.com/3906504

Wouldn't this also apply if 'define' is previously defined ? Given that both AMD and CommonJS export type (including nodejs' quirky one) are well defined standards, it seems fair to support both equally and to require other other coding paradigms to stay clear of those standard, doesn't it ?

Regarding the node detector, while it might be a nice solution it does look a little hacky and too node.js specific. What about other commonjs like implementations ?

comment:8 Changed 5 years ago by dmethvin

@rwaldron, did you plan on getting this done by 2.0?

comment:9 Changed 4 years ago by m_gol

What's the current status of work on this feature?

comment:10 Changed 4 years ago by Rick Waldron

@m_gol the current status is that I'm working on it...

comment:12 Changed 4 years ago by dmethvin

Milestone: 2.02.next

comment:13 Changed 4 years ago by m_gol

Milestone: 2.next1.11/2.1

It was decided we want that for jQuery 2.1.

comment:14 Changed 4 years ago by m_gol

Milestone: 1.11/2.12.1

comment:15 Changed 4 years ago by timmywil

Blocked by: 14451 added

(In #14451) @jzaefferer: Completing the release script will allow #13119 to be closed. I'll add that ticket to blocking.

comment:16 Changed 4 years ago by m_gol

I guess it should be re-assigned to timmywil, right?

comment:17 Changed 4 years ago by m_gol

Should we unpublish https://npmjs.org/package/jQuery? It introduces additional noise and confuses users.

What do you think, isaacs?

comment:18 Changed 4 years ago by m_gol

jQuery 2.1.0-beta2 has been published to npm. \o/

Please, test & report issues with the package, if any.

comment:19 Changed 4 years ago by timmywil

Owner: changed from Rick Waldron to timmywil

Assigning to myself as a reminder to follow up concerning the "jQuery" repo.

comment:20 Changed 4 years ago by anonymous

any news?

comment:21 in reply to:  20 Changed 4 years ago by m_gol

Replying to anonymous:

any news?

This is done: https://npmjs.org/package/jquery

Please, test if you're interested so that we can see if everything is OK *before* releasing the final version.

comment:22 Changed 4 years ago by timmywil

Blocked by: 14451 removed
Resolution: fixed
Status: assignedclosed
Version: git2.0.3

Closing as no more work need be done to ensure the final release goes on NPM.

comment:23 Changed 4 years ago by christoph.burgmer@…

The packaged version does not work in the browser. I receive the following error:

ReferenceError: module is not defined module.exports = create('undefined' === typeof window ? undefined : window);

My expectation: jquery installed via npm should be easy to reference from a web page.

A UMD wrapper might be a technically sound way of solving this.

comment:24 in reply to:  23 Changed 4 years ago by m_gol

Replying to christoph.burgmer@…:

The packaged version does not work in the browser. I receive the following error:

ReferenceError: module is not defined module.exports = create('undefined' === typeof window ? undefined : window);

My expectation: jquery installed via npm should be easy to reference from a web page.

We need more information about the problem, that doesn't say much... Specifically: how are you installing jQuery, how do you include it in a web page, how do you refer to it, what tools do you use to manage jQuery etc.

Note: See TracTickets for help on using tickets.