Skip to content

jquery 2.2.1 breaks webpack builds when loading individual modules #2945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bertez opened this issue Feb 24, 2016 · 19 comments
Closed

jquery 2.2.1 breaks webpack builds when loading individual modules #2945

bertez opened this issue Feb 24, 2016 · 19 comments

Comments

@bertez
Copy link

bertez commented Feb 24, 2016

Hi,

after this change 5943f1d webpack builds are broken when loading individual modules:

ERROR in ./~/jquery/src/selector-sizzle.js Module not found: Error: Cannot resolve 'file' or 'directory' ../external/sizzle/dist/sizzle in /Users/berto/Temp/webpack-jquery/node_modules/jquery/src @ ./~/jquery/src/selector-sizzle.js 1:0-14:3

I think this is happening because in 2.2.1 'selector-sizzle.js' is trying to load the sizzle dependency as '../external/sizzle/dist/sizzle' a file which does not exist, unlike in 2.2.0 (for instance) which loads 'sizzle'.

I set up a simple example here: https://github.com/bertez/webpack-jquery

npm install
npm run build

Thank you very much in advance.

@hccampos
Copy link

Indeed, experiencing the same thing here. Should be possible to add some alias to the config to fix it, but would indeed be much better if jquery just loaded 'sizzle' so that webpack can fetch it from the node_modules folder or wherever it is resolving from.

@mgol
Copy link
Member

mgol commented Feb 24, 2016

It seems we should have included external/sizzle in the published package. Could you check if it starts working if you copy this directory from the jQuery repo to node_modules/jquery/external/sizzle/?

@mgol mgol added this to the 1.12.2/2.2.2 milestone Feb 24, 2016
@timmywil
Copy link
Member

yup, external/sizzle should have been included. We could actually fix this in npm for 1.12.1/2.2.1.

@timmywil
Copy link
Member

We'll include this fix in 1.12.2/2.2.2.

@timmywil
Copy link
Member

Fixed by ed94387, 5d620be, and 8a91f84.

@bertez
Copy link
Author

bertez commented Feb 24, 2016

Thank you!

@phkavitha
Copy link

What's the fix for this? I find that the version 1.12.2 and 2.2.2 is still not available in CDN (https://code.jquery.com/jquery/).

@bertez
Copy link
Author

bertez commented Feb 26, 2016

2.2.0 is working for me...

@mgol
Copy link
Member

mgol commented Feb 26, 2016

We'll discuss it on Monday. We might need to fix more things and we don't want to release every few days.

@phkavitha
Copy link

Thanks @bertez . It worked for me. I used jquery v2.2.0 and sizzle v2.3.0.

@musicformellons
Copy link

mmh, just installed 1.12.3 and still got this error; after adding an external folder etc it worked.

@codahale
Copy link

codahale commented May 8, 2016

This doesn’t appear to be fixed. I’m getting this error w/ 2.2.2 and 2.2.3:

ERROR in ../~/jquery/src/selector-sizzle.js
Module not found: Error: Can't resolve '../external/sizzle/dist/sizzle' in '/Users/coda/Projects/example/node_modules/jquery/src'
 @ ../~/jquery/src/selector-sizzle.js 1:13-313

The reference is to ../external/sizzle/dist/sizzle, but no directory named external exists in node_modules/jquery:

$ tree node_modules/jquery/
node_modules/jquery/
├── AUTHORS.txt
├── LICENSE.txt
├── README.md
├── bower.json
├── dist
│   ├── jquery.js
│   ├── jquery.min.js
│   ├── jquery.min.map
│   ├── jquery.slim.js
│   ├── jquery.slim.min.js
│   └── jquery.slim.min.map
├── package.json
├── sizzle
│   ├── LICENSE.txt
│   └── dist
│       ├── sizzle.js
│       ├── sizzle.min.js
│       └── sizzle.min.map
└── src
    ├── ajax
    │   ├── jsonp.js
etc. etc.

@mgol
Copy link
Member

mgol commented May 8, 2016

Yeah, this was not fixed correctly. Everything from the extras array is copied directly to the final directory which doesn't preserve the directory structure, making the sizzle folder appear without the necessary external directory wrapper.

Reopening & marking as a blocker.

@mgol mgol reopened this May 8, 2016
@mgol mgol modified the milestones: 1.12.4/2.2.4, 1.12.2/2.2.2 May 8, 2016
@mgol mgol added the Blocker label May 8, 2016
@timmywil timmywil self-assigned this May 8, 2016
@mgol
Copy link
Member

mgol commented May 8, 2016

It'd be good to have a way of testing if the final structure is OK.

@timmywil
Copy link
Member

timmywil commented May 9, 2016

I thought it was working, but maybe my local copy was wrong. It's tough to make an automated test because it's going through jquery-release. But, once it's working, we shouldn't have to touch it again.

@fleea
Copy link

fleea commented May 9, 2016

Same problem here:

Module not found: Error: Cannot resolve 'file' or 'directory' ../external/sizzle/dist/sizzle

When I copied the content of sizzle/dist to external/zizzle/dist, it compiled ok.

@yoga1290
Copy link

yoga1290 commented May 9, 2016

The latest uncompressed jQuery worked here with Webpack after adding window.jQuery = window.$ = jQuery; just before the last return line

@jvreeken
Copy link

same problem here, ERROR in ./~/jquery/src/selector-sizzle.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../external/sizzle/dist/sizzle

@timmywil
Copy link
Member

We will have a fix in the next patch. Please use GitHub's reaction feature on the original post if you're having the same issue.

timmywil added a commit to timmywil/jquery that referenced this issue May 11, 2016
timmywil added a commit to timmywil/jquery that referenced this issue May 11, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.