-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[Packager] this["require"]() form is not supported. Needed for scala-js #465
Comments
The react-native JSX processor seems to not properly handle imports when bracket selects are used (see facebook/react-native#465). As a quick workaround, we pass the output of fullOptJS to react-native.
Note that browserify has the same shortcoming. The dependency analyzer just scans for require(string litteral) |
So are you saying that this is actually a browserify issue (as in you are using browserify internally), or just that you are emulating the same behavior? How desirable and how hard would allowing both syntaxes be to you guys? The issue we are facing is with code that is supports the Google Closure Compiler's advanced mode (generated by Scala.js) and must bracket select in this position if we don't want the call to be renamed. On the other hand, fully minimizing the file is not an option in the development cycle in the long run as it takes too long. |
could you tell Closure that "require" is an extern? https://developers.google.com/closure/compiler/docs/api-tutorial3#externs |
Yes, we could. However, the Scala.js compiler is (currently) not able to emit dot selects for anything but its internal code. Have a look at scala-js/scala-js#761 for a discussion on why supporting both is hard. |
I think we can handle this case in the RegExp. If you want to take a shot at it look at Note there is another PR trying to make it so we share the same Regexp and fixes some issues with whitespace: #316 |
any progress on this ... |
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
What can we do to prevent closure of the issue? This is an issue for (potentially) many JS processors, just closing it because it has been inactive seems odd... |
@gzmo: that's a very good point, we're working on the bot right now and we still haven't figured out all the use cases. We definitely don't want to close this issue |
I want to experiment with moving to an AST-based require analysis, provided it doesn't regress perf that much. Especially know that @martinbigio added caching for module dependencies. |
@amasad thanks for taking time to look into this, any luck ? , debugging production mode code in development phase is not fun :( |
Bump... |
@mariussoutier, @gzm0, @chandu0101 any one of you want to take a stab at implementing it on React Native? It is not very hard. You need to update this regex in order to support both |
Done, see #4830. |
@vjeux thanks alot for pointer @mariussoutier excellent 👍 |
Consider the following two pieces of codeé
After bundling, we have the following diff:
In the bracket select case, the JSX processor seems to be unable to detect the inclusion, even though the two pieces of code are equivalent from a JavaScript point of view.
See the original post on SO by @ChrisJamesC.
The text was updated successfully, but these errors were encountered: