#10674 closed bug (fixed)
AMD loading broken on minified scripts
Reported by: | sephii | Owned by: | Scott González |
---|---|---|---|
Priority: | minor | Milestone: | 1.12.0 |
Component: | [meta] ui.build | Version: | 1.11.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Using requirejs and trying to use jquery ui plugins from the minified/ directory raises a "Error: Script error for: jquery-ui/core". This is because minified scripts depend on "./core" instead of "./core.min".
This occurs in version 1.11.2, installed with Bower.
Change History (13)
comment:1 Changed 8 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 8 years ago by
After reporting it to the maintainers of the components organization, it looks like this is indeed a bug on the jQuery UI side. It's apparently caused by the minify task from the Gruntfile that doesn't rewrite the dependencies after renaming the files. See https://github.com/components/jqueryui/issues/42 for more info.
Could you please reopen this issue?
comment:3 Changed 8 years ago by
Before reopening this, I'd like to confirm that we want to keep this task. If we do keep it, we should probably just stop renaming the files. There definitely shouldn't be a "core.min" dependency, it should just be "core".
comment:4 Changed 8 years ago by
sephii, what's the motivation for loading minified files using AMD? Seems like you should be loading non-minified files, then use the optimizer to create one or more optimized, minified files for production.
comment:5 Changed 8 years ago by
We're going to remove the wrappers in the minified files. As Jörn has said, you should be doing the minification yourself using the optimizer.
comment:6 Changed 8 years ago by
Resolution: | notabug |
---|---|
Status: | closed → reopened |
comment:7 Changed 8 years ago by
Owner: | set to tj.vantoll |
---|---|
Status: | reopened → assigned |
comment:8 Changed 8 years ago by
The way we handle this in jQuery mobile is by parsing them out using comments read by the build script https://github.com/jquery/jquery-mobile/blob/master/js/core.js#L1-L2 https://github.com/jquery/jquery-mobile/blob/master/Gruntfile.js#L380
comment:9 Changed 8 years ago by
arschmitz correct me if I'm wrong. But, jQuery mobile doesn't handle this at all. Its final bundles (both the normal and the minified) include the generated-on-build-time UMD wrapper. It happens that, similarly to jQuery UI, the only bundle's dependency is jquery
.
Anyway, the jquery
dependency is safe from this minified problem. Because, jQuery is one of the few exceptions on AMD that defines itself as a named module. So, if one loads jquery.min.js, this code will be defined as a jquery
AMD module.
comment:10 Changed 8 years ago by
On jQuery UI, we are distributing different things depending of the "channel":
- via download builder, we're distributing the bundles (JS and CSS) as defined by https://github.com/jquery/download.jqueryui.com/pull/214 and https://github.com/jquery/download.jqueryui.com/issues/207.
- via grunt task (via dist/), we're distributing the JS bundles only (no CSS) plus the minified JS components, but no images.
Questions to ourselves:
- Should the
dist/
folder of our repo be considered, as it sounds like, a distribution "channel"? - Which files should it include? The same ones of our download package?
comment:11 Changed 8 years ago by
Component: | ui.core → [meta] ui.build |
---|---|
Owner: | changed from tj.vantoll to scott.gonzalez |
comment:12 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Build: Don't use .min.js extension for individual source files
We don't actually use these files for anything other than size comparisons, but having the .min.js extension means that AMD is broken.
Note: If you're using AMD with the minified files, just run a build instead.
Fixes #10674 Closes gh-1466
Changeset: 47a32fb5b3c190123937e0178900ef754c3e220d
comment:13 Changed 8 years ago by
Milestone: | none → 1.12.0 |
---|
You're probably looking for https://github.com/components/jqueryui/issues/new since we don't host minified files.