Skip to content

paths option #754

Description

@Rich-Harris

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
  },
  // ...
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions