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

OptimizeChunks not applying on first generate #2570

Open
guybedford opened this issue Nov 25, 2018 · 2 comments
Open

OptimizeChunks not applying on first generate #2570

guybedford opened this issue Nov 25, 2018 · 2 comments

Comments

@guybedford
Copy link
Contributor

guybedford commented Nov 25, 2018

  • Rollup Version:
  • Operating System (or Browser):
  • Node Version:

How Do We Reproduce?

Reproduction case: https://github.com/keithamus/rollup-repro/tree/expanded

Expected Behavior

Using optimizeChunks should result in the new chunk names being rendered during generation.

Actual Behavior

The previous chunk names are rendered into dependencies, and only after running generate again are the correct chunk names used.

@guybedford
Copy link
Contributor Author

To clarify - the CLI output is giving chunk references like chunk__3 where that chunk was already merged into chunk__1 by the optimizing phase.

@guybedford guybedford changed the title OptimizeChunks working in API but not CLI output OptimizeChunks not applying on first generate Nov 25, 2018
@guybedford
Copy link
Contributor Author

The workaround for this is to run a build like:

const rollup = require('../rollup');

rollup.rollup({
  experimentalCodeSplitting: true,
  optimizeChunks: true,
  input: ['main1.js', 'main2.js', 'main3.js']
}).then(build => {
  return build.generate({ format: 'amd' })
  .then(generated => {
    return build.generate({ format: 'amd' });
  });
}).then(generated => {
  console.log(generated);
})
.catch(e => {
  console.log(e);
})

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

No branches or pull requests

3 participants