Skip to main content

Bug Tracker

Side navigation

#15061 closed bug (migrated)

Opened April 29, 2014 09:11AM UTC

Closed October 21, 2014 12:36AM UTC

"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/

Attachments (0)
Change History (5)

Changed April 29, 2014 09:20AM UTC by corbacho comment:1

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/

Changed April 30, 2014 07:03PM UTC by corbacho comment:2

_comment0: I reduced the bug to this command (building an empty jQuery) \ \ {{{ \ jquery build:* \ }}} \ \ it contains these 2 lines: \ \ {{{ \ define([]); \ define("jquery", function(){}); \ }}} \ 1398939979212074

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

grunt build:*

it contains these 2 lines:

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

Changed April 30, 2014 07:06PM UTC by dmethvin comment:3

component: unfiledbuild
priority: undecidedlow
status: newopen

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

Changed May 01, 2014 10:38AM UTC by corbacho comment:4

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)

Changed October 21, 2014 12:36AM UTC by m_gol comment:5

resolution: → migrated
status: openclosed