Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define Incorrectly Updated When No Dependencies And Function Wrapped In Parentheses #1007

Open
davehawkins4f opened this issue Sep 28, 2020 · 0 comments

Comments

@davehawkins4f
Copy link

There is a javascript performance optimisation where functions supplied as arguments are wrapped in parentheses. This is applied, for example, by the terser minifier. This confuses r.js when a define has no dependencies and it incorrectly updates the call:

test.js - original module

define(function () {});

test_min.js - generated by, eg, terser

define((function(){}));

test_bundle.js - r.js -o name=test paths.test=test_min out=test_bundle.js optimize=none

define(('module_name',[],function(){}));

The arguments have been incorrectly inserted inside the parentheses surrounding the function rather than as arguments to the define call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant