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

paths option #754

Closed
Rich-Harris opened this issue Jun 27, 2016 · 2 comments · Fixed by #780
Closed

paths option #754

Rich-Harris opened this issue Jun 27, 2016 · 2 comments · Fixed by #780

Comments

@Rich-Harris
Copy link
Contributor

Scenario: your bundle depends on an external library, but you don't want to do this sort of thing:

import react from 'https://npmcdn.com/react@15.0.1/dist/react.min.js';

// or, e.g. in /bin/my-lib
import myLib from '../dist/my-lib.js'

In the second case, you can end up in all sorts of contortions if the relative path from the bundle isn't the same as the relative path from the source file.

Proposed solution: use an external module ID, as normal, but then:

// rollup.config.js
export default {
  entry: 'src/main.js',
  dest: 'bundle.js',
  paths: {
    'react': 'https://npmcdn.com/react@15.0.1/dist/react.min.js',
    'my-lib': '../dist/my-lib.js' // relative to bundle
  },
  // ...
};
@TrySound
Copy link
Member

Isn't rollup-plugin-alias the same?

@Rich-Harris
Copy link
Contributor Author

Not unless I've misunderstood rollup-plugin-alias – this is about external dependencies. (By extension, paths keys should probably be added to external, in the same way that globals keys are)

Rich-Harris added a commit that referenced this issue Jul 10, 2016
Rich-Harris added a commit that referenced this issue Jul 10, 2016
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 a pull request may close this issue.

2 participants