Bug Tracker

Ticket #13119 (closed bug: fixed)

Opened 2 years ago

Last modified 10 months ago

Make jQuery releases available via npm

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

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

comment:1 Changed 2 years ago by rwaldron

  • Owner set to rwaldron
  • Status changed from new to assigned

comment:2 Changed 2 years ago by rwaldron

  • Cc isaacs added
  • Milestone changed from None to 1.9

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

comment:3 Changed 2 years ago by dmethvin

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

comment:4 follow-up: ↓ 7 Changed 2 years ago by 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

comment:5 Changed 2 years ago by dmethvin

  • Priority changed from undecided to high
  • Component changed from unfiled to build
  • Milestone changed from 1.9 to 2.0

comment:6 Changed 2 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 23 months 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 23 months ago by dmethvin

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

comment:9 Changed 20 months ago by m_gol

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

comment:10 Changed 20 months ago by rwaldron

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

comment:12 Changed 19 months ago by dmethvin

  • Milestone changed from 2.0 to 2.next

comment:13 Changed 15 months ago by m_gol

  • Milestone changed from 2.next to 1.11/2.1

It was decided we want that for jQuery 2.1.

comment:14 Changed 14 months ago by m_gol

  • Milestone changed from 1.11/2.1 to 2.1

comment:15 Changed 13 months 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 13 months ago by m_gol

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

comment:17 Changed 13 months 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 12 months 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 12 months ago by timmywil

  • Owner changed from rwaldron to timmywil

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

comment:20 follow-up: ↓ 21 Changed 10 months ago by anonymous

any news?

comment:21 in reply to: ↑ 20 Changed 10 months 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 10 months ago by timmywil

  • Status changed from assigned to closed
  • Version changed from git to 2.0.3
  • Resolution set to fixed
  • Blocked by 14451 removed

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

comment:23 follow-up: ↓ 24 Changed 10 months 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 10 months 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.