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
},
// ...
};
Scenario: your bundle depends on an external library, but you don't want to do this sort of thing:
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: