-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Order of the Main File Is Not Being Respected #1392
Comments
Please create a reproduction of your issue via the repl or an example github repo. |
Apologies, I couldn't find the repl thingy before and didn't notice the link in the corner. My issue is illustrated here |
No worries. Thanks for putting it together. I'll have a look today for sure. |
You're looking for the outro option. |
Thank You very much. That did the trick! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I'm trying to force Rollup to put some init code after the exports block, however so far I was not able to find any way to do so, except manually changing the output file. I have opened a thread on StackOverflow where I got the suggestion that it might be a bug:
http://stackoverflow.com/questions/43687262/appending-code-after-exports-list-with-rollup-js
But I am guessing this is expected behavior as the init code I'm placing is basically invalid - it uses the exports variable which is undefined in the context of the code (but exists after rollup makes the bundle, so then the code starts to make sense).
In my main file, I first export all of my module's public members and then there's the problematic block of code responsible for firing a ready event. Problem is, the event handlers assume the module has been fully exported, but rollup places the exports block after the init code (swapping the order) so the event handlers throw reference errors as the module's members have not yet been exported (not assigned to the exports object).
I tried placing
//<init>
comment in the code and using a bash command to replace this with the actual init code after the build is done, but even the comment is placed before the exports block in the resulting file.I am using the
IIFE
format, however the order is the same with other formats as well.Is this actually a bug, or is there some setting/plugin for Rollup that could achieve this?
Thank You in advance.
The text was updated successfully, but these errors were encountered: