stealjs / steal-tools

Build easy. Load fast.

Home Page:https://stealjs.com/docs/steal-tools.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Error: define is not a function` when using `deps-bundle`

eben-roux opened this issue · comments

commented

I am using steal-tools v1.11.9 and when the application loads Error: define is not a function appears in the console.

To be sure I deleted the node_modules from the steal-tools global folder and re-installed and did the same for my application but to no avail.

Can you provide more information like a stack trace and the code snippet that is throwing? This is possibly coming from a dependency.

commented

There is a really long bit of red code logged to the console which I'm guessing is the entire bundle so I cannot paste that.

But it start like this:

image

And ends like so:

image

Let me know if there is something specific that I can provide.

First I would run the bundle command with --no-minify so you can see better what is going on. Then I would click on the first link in the stack trace. It should take you to the code, copy and paste what you see there.

commented

It appears as though the minifying may be contributing to the original issue.

By using the --no-minify option I do not get the error.

@eben-roux What version of steal-tools?

@m-mujica Does this sound at all like the infamous dev bundles regexp issue?

commented

steal-tools: 1.11.9

@matthewp yeah, seems like it, Eben is using the latest version tho and looking at the screenshots it seems the module preloading the npm stuff is indeed at the bottom of the bundle.

We only prepend the bundles config, I don't think there is anything there that might break the regex.

commented

It appears as though the minification is ending the functions with a comma whereas the original code had a semi-colon. Still investigating this...

Original:

image

Minified:

image

commented

OK, so the comma doesn't seem to affect anything. However, when I compared the working minified code from Manuel's branch to the current one the ordering is definitely out of whack.

However, upon further investigation it turns out that the graph ordering on what appears to be the same level is non-deterministic which is why it looks slightly different each time the graph is built. Slightly odd but shouldn't be a problem.