Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#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 3 years ago by Scott González

Resolution: notabug
Status: newclosed

You're probably looking for https://github.com/components/jqueryui/issues/new since we don't host minified files.

comment:2 Changed 3 years ago by sephii

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 3 years ago by Scott González

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 3 years ago by Jörn Zaefferer

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.

Last edited 3 years ago by Jörn Zaefferer (previous) (diff)

comment:5 Changed 3 years ago by Scott González

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 3 years ago by tj.vantoll

Resolution: notabug
Status: closedreopened

comment:7 Changed 3 years ago by tj.vantoll

Owner: set to tj.vantoll
Status: reopenedassigned

comment:8 Changed 3 years ago by Alexander Schmitz

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 3 years ago by rxaviers

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.

Last edited 3 years ago by rxaviers (previous) (diff)

comment:10 Changed 3 years ago by rxaviers

On jQuery UI, we are distributing different things depending of the "channel":

Questions to ourselves:

  1. Should the dist/ folder of our repo be considered, as it sounds like, a distribution "channel"?
  2. Which files should it include? The same ones of our download package?
Last edited 3 years ago by rxaviers (previous) (diff)

comment:11 Changed 2 years ago by Scott González

Component: ui.core[meta] ui.build
Owner: changed from tj.vantoll to scott.gonzalez

comment:12 Changed 2 years ago by Scott González

Resolution: fixed
Status: assignedclosed

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 2 years ago by Scott González

Milestone: none1.12.0
Note: See TracTickets for help on using tickets.