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

Correct error in #2101 #2123

Merged
merged 1 commit into from Apr 16, 2018
Merged

Correct error in #2101 #2123

merged 1 commit into from Apr 16, 2018

Conversation

guybedford
Copy link
Contributor

The issue is that when providing input: 'file.js', output: { dir: 'dist' }, Rollup thinks it is doing a single-file build, but the CLI was providing the error: "You must specify an --output (-o) option when creating a file with a sourcemap" which is completely useless.

With this change, the error now provided in this case is "You must specify output.file when doing a single-file input build".

We could perhaps clarify this even more as well.

To clarify the code-splitting logic here:

  1. The experimental code splitting flag is treated as an experimental feature flag - that is, it doesn't imply a code splitting workflow on its own as the idea is that this flag will just be removed entirely one day.
  2. We thus use the fact that the input is an array or object to indicate that this is a code-splitting workflow.
  3. We can't easily check the output.dir option as the primary indicator that it is a code-splitting workflow because output options only known at generate time, while the type of build has to be determined from the input options already.

Happy to reconsider the logic here... perhaps a codeSplitting: true / false would make this clearer to users which build they are doing.

@guybedford
Copy link
Contributor Author

I've clarified the previous suggestion in #2092 (comment), would be interested to hear feedback further.

@lukastaegert
Copy link
Member

We can't easily check the output.dir option as the primary indicator that it is a code-splitting workflow because output options only known at generate time, while the type of build has to be determined from the input options already.

See #2092 (comment), my hope is that at some point, there is no "separate code-splitting workflow".

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@lukastaegert lukastaegert merged commit 8cb99c4 into master Apr 16, 2018
@lukastaegert lukastaegert added this to the 0.58.0 milestone Apr 16, 2018
@lukastaegert lukastaegert deleted the 2101-error-correction branch April 16, 2018 06:26
@lukastaegert
Copy link
Member

Fun fact: This also fixes the issue that experimentalPreserveModules did not output anything if input was not an array. Should remember do add a test case for this at some point.

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

Successfully merging this pull request may close these issues.

None yet

2 participants