Skip to content

Correct error in #2101 - #2123

Merged
lukastaegert merged 1 commit into
masterfrom
2101-error-correction
Apr 16, 2018
Merged

lukastaegert merged 1 commit into
masterfrom
2101-error-correction

Conversation

@guybedford

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@lukastaegert

Copy link
Copy Markdown
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".

@lukastaegert lukastaegert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

@lukastaegert
lukastaegert force-pushed the 2101-error-correction branch from 070f3dc to 8cb99c4 Compare April 16, 2018 05:23
@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
Copy Markdown
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.

2 participants