pmowrer / rollup-plugin-peer-deps-external

Automatically externalize `peerDependencies` in a rollup bundle.
MIT License
109 stars 16 forks source link

Examples #4

Closed robhicks closed 6 years ago

robhicks commented 6 years ago

A simple, complete example would help. For example, this doesn't work:

const buble = require('rollup-plugin-buble');
const peerDepsExternal = require('rollup-plugin-peer-deps-external');
export default [
  {
    input: client,
    plugins: [
      peerDepsExternal(),
      buble({ transforms: { dangerousTaggedTemplateString: true } })
    ],
    output: {
      name: 'IdxEsmUtils',
      file: 'dist/idx-esm-utils.iife.js',
      format: 'iife'
    }
  },
  {
     input: client,
    plugins: [
      peerDepsExternal(),
      buble({ transforms: { dangerousTaggedTemplateString: true } }
    ],
    output: {
      name: 'IdxEsmUtils',
      file: 'dist/idx-esm-utils.iife.min.js',
      format: 'iife'
    }
  },
{
    input: client,
    plugins: [
      peerDepsExternal()
    ],
    output: {
      file: 'dist/idx-esm-utils.mjs',
      format: 'es'
    }
  },
 {
     input: client,
     plugins: [
      peerDepsExternal()
    ],
    output: {
      file: 'dist/idx-esm-utils.min.mjs',
      format: 'es'
    }
  },
 {
    input: server,
    plugins: [
      peerDepsExternal()
    ],
    output: {
      file: 'index.js',
      format: 'cjs'
    }
  }
];
import { hyper, bind, wire } from 'hyperhtml';

This results in an error:

Uncaught TypeError: Failed to resolve module specifier "hyperhtml". Relative references must start with either "/", "./", or "../".

I have also tried it using nodeResolve both before and after peerDepsExternal.

pmowrer commented 6 years ago

Hi @robhicks!

What do you feel is missing from the examples?

There's a lot going on in the sample you provided. It'd be helpful if you could boil it down a bit to understand what's going on. For example, there are 5 outputs in the sample, but I'd have to imagine you'd only need 1 to reproduce the problem. Also, what does the input file and the package.json look like.

pmowrer commented 6 years ago

Closing due to inactivity