referee icon indicating copy to clipboard operation
referee copied to clipboard

Bundle does not works in browser due to missing externals

Open blikblum opened this issue 6 years ago • 4 comments

We understand you have a problem and are in a hurry, but please provide us with some info to make it much more likely for your issue to be understood, worked on and resolved quickly.

I'm trying to use referee in a browser environment, more specifically in karma. I'm loading the bundle version ('dist/referee.js') But it crashes because of missing dependencies in the bundle

  • library version : "@sinonjs/referee": "^3.2.0"
  • Environment : karma 4.x
  • Example URL : https://github.com/blikblum/slick-router/blob/use-open-wc-testing/karma.conf.js#L10
  • Other libraries you are using:

What did you expect to happen? referee bundle should work on browsers

What actually happens referee crashes on browser

How to reproduce

Describe with code how to reproduce the faulty behaviour, or link to code on JSBin or similar

Try to load bundle ('dist/referee.js') as a script on browser

This occurs because rollup does not bundle external dependencies by default. To do so is necessary to use 'rollup-plugin-node-resolve'

Let me know if a PR is accepted to make a bundle that works on browser

blikblum avatar Dec 15 '19 22:12 blikblum

Thank you for reporting this. Before you create PR with changes, would you mind creating a minimal reproducible example? It could be as simple as using a codepen.

mroderick avatar Dec 16 '19 09:12 mroderick

See https://codepen.io/blikblum/pen/bGNBdWz

I tried to add scripts for @sinonjs/commons and @sinonjs/formatio but they don't have dist / bundles

In fact i looked a bit more and the dependency graph is to big so making workable browser bundle may require an amount of work i can't provide.

blikblum avatar Dec 16 '19 10:12 blikblum

👍

mroderick avatar Dec 16 '19 12:12 mroderick

The mentioned plugin has been moved to https://github.com/rollup/plugins/tree/master/packages/node-resolve

mroderick avatar Dec 16 '19 12:12 mroderick