Bug Tracker

Opened 9 years ago

Closed 8 years ago

#15061 closed bug (migrated)

"define" is not defined error. Broken build

Reported by: corbacho Owned by:
Priority: low Milestone: None
Component: build Version: 2.1.0
Keywords: Cc:
Blocked by: Blocking:

Description

When building a custom jQuery (master branch) with this command:

grunt build:*:+core/ready

It will output about the line 47:

define("jquery", function(){});

This produces the error

ReferenceError: define is not defined

Why I'm using grunt build? I know that "grunt custom" is the recommended alias, but I'm trying to build a minimum possible jQuery that contains the necessary code for a reliable $(document).ready() . I want to propose this solution to be part of the upcoming Drupal 8 core, as an alternative to domready solution https://github.com/ded/domready that we are using now

The whole command is :

grunt build:*:+core/ready:+exports/global:-exports/amd:-ajax:-ajax/xhr:-ajax/script:-ajax/jsonp:-css:-deprecated:-dimensions:-effects:-event:-event/alias:-offset:-wrap:-sizzle:-queue:-data:-css:-selector:-traversing:-serialize

This builds a 11Kb size domready solution. 5Kb gzipped

Removing the buggy line mentioned before, it works: http://jsfiddle.net/WnhWc/2/

Change History (5)

comment:1 Changed 9 years ago by corbacho

Ignore the jsfiddle link. These are correct:
The bug http://jsfiddle.net/WnhWc/4/
The fixed one (removing line 47) http://jsfiddle.net/WnhWc/3/

comment:2 Changed 9 years ago by corbacho

I reduced the bug to this command (building an empty jQuery)

grunt build:*

it contains these 2 lines:

define([]);
define("jquery", function(){});
Last edited 9 years ago by corbacho (previous) (diff)

comment:3 Changed 9 years ago by dmethvin

Component: unfiledbuild
Priority: undecidedlow
Status: newopen

Thanks for reducing it more. I'll mark this open, patches or further testing welcome.

comment:4 Changed 9 years ago by corbacho

Pull request that fix one of the issues:

define([]);

https://github.com/jquery/jquery/pull/1569 Working now on fixing the other "define" that shouldn't be there (They are not related)

comment:5 Changed 8 years ago by m_gol

Resolution: migrated
Status: openclosed
Note: See TracTickets for help on using tickets.