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

ExternalModule renderPath doesn't change with multiple outputs? #2675

Closed
danielmahal opened this issue Feb 1, 2019 · 1 comment · Fixed by #2706
Closed

ExternalModule renderPath doesn't change with multiple outputs? #2675

danielmahal opened this issue Feb 1, 2019 · 1 comment · Fixed by #2706

Comments

@danielmahal
Copy link

danielmahal commented Feb 1, 2019

  • Rollup Version: 1.1.2
  • Operating System (or Browser): Mac OS X 10.14 (18A391)
  • Node Version: 10.11.0

How Do We Reproduce?

// input.js

import answer from 'the-answer'
console.log(answer)
// rollup.config.js

export default {
  input: './input.js',

  external: [
    'the-answer'
  ],

  output: [
    {
      file: 'cjs.js',
      format: 'cjs'
    },

    {
      file: 'esm.js',
      format: 'esm',
      paths: id => `//unpkg.com/${id}@?module`
    }
  ]
}

rollup -c

Expected Behavior

// esm.js

import answer from '//unpkg.com/the-answer@?module';

console.log(answer);

Actual Behavior

//esm.js

import answer from 'the-answer';

console.log(answer);

If we reverse the order of outputs in the config, the output.paths work properly for the esm ouput, but the cjs ouput will have the wrong paths (unpkg ones)

The issue only applies in multioutput configutations

Maybe the problem is that renderPath is being reused?
https://github.com/rollup/rollup/blob/master/src/Chunk.ts#L600

@lukastaegert
Copy link
Member

Thanks for spotting this, fix at #2706

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