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

getFileName returns incorrect result with multiple outputs #3467

Closed
LarsDenBakker opened this issue Mar 28, 2020 · 6 comments · Fixed by #3645
Closed

getFileName returns incorrect result with multiple outputs #3467

LarsDenBakker opened this issue Mar 28, 2020 · 6 comments · Fixed by #3645

Comments

@LarsDenBakker
Copy link
Contributor

LarsDenBakker commented Mar 28, 2020

Expected Behavior

When using this.getFileName on a manually created chunk, I don't get the correct filename with multiple build outputs. In generateBundle for both phases, I get the filename of the last output.

I set the output to directory, since the REPL doesn't seem to support multiple outputs?

Actual Behavior

I get the same same file name for both phases.

@lukastaegert
Copy link
Member

Please do not forget to add the Rollup version to the template. I assume it is the latest but once someone gets to looking into this, who knows what latest was when you created the issue.

@LarsDenBakker
Copy link
Contributor Author

LarsDenBakker commented Mar 28, 2020

Sorry about that, I got this with rollup v2.2.0 locally and the v1.31. loaded by the repl. I updated the original issue.

@lukastaegert
Copy link
Member

lukastaegert commented Mar 30, 2020

Ok, this one is nastier than I thought. Basically it is caused by an unfortunate design decision where chunk objects are reused for each output. The long term goal is to refactor everything so that this is no longer the case, but the question is how long this will take. This would also fix this issue. But I am not sure how to provide a short-term fix.

@LarsDenBakker
Copy link
Contributor Author

Thanks for looking into it. For now I am able to work around it by using two separate output plugins.

lukastaegert added a commit that referenced this issue May 11, 2020
lukastaegert added a commit that referenced this issue May 13, 2020
lukastaegert added a commit that referenced this issue May 15, 2020
lukastaegert added a commit that referenced this issue May 20, 2020
lukastaegert added a commit that referenced this issue May 25, 2020
lukastaegert added a commit that referenced this issue May 27, 2020
* Add test for #3467

* Extract multi-chunk option validation from output option parsing

* Reorder rollup entry by usage

* Get rid of chunk generation parameters

* Introduce Bundle class

* Make generate a little nicer

* Split option parsing

* Split merging from parsing

* Start implementing normalized input options

* Normalize treeshaking options and warnings

* Normalize input, manualChunks, signatures and inline validation

* Normalize remaining options

* Fix CLI object option handling

* Start normalizing output options

* Normalize file name options

* Normalize addons

* Normalize flags

* Normalize dynamicImportFunction and exports

* Normalize globals, name and paths

* Make options private in Graph

* Refactor option usage

* Fix types

* Remove unrelated TODOs

* Update docs

* Improve coverage

* Fix url in builtin warning
@lukastaegert lukastaegert mentioned this issue Jun 20, 2020
9 tasks
@lukastaegert
Copy link
Member

Fix at #3645, which will finally move chunk creation to the output generation phase and make manualChunks, inlineDynamicImports and preserveModules output options.

@LarsDenBakker
Copy link
Contributor Author

Thats great! It enables a lot of possibilities.

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

Successfully merging a pull request may close this issue.

2 participants