This repository was archived by the owner on Aug 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
Bundled dependencies built with browserify broken #77
Copy link
Copy link
Closed
Description
The newest version (3.1.0) broke some of my dependencies.
For example, I bundle video.js which is built with grunt-browserify. The first line of their dist/video.js has a umd wrapper around browserify's browser-pack prelude:
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.videojs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){There are two problematic lines in the browser-pack prelude:
var a=typeof require=="function"&&require;var i=typeof require=="function"&&require;
Version 3.1.0 of this plugin transforms these lines into:
var a='function'=="function"&&require;var i='function'=="function"&&require;
This breaks the code at run time inside a browser with strict mode enabled, since there's no global require function.
For now, I've pinned my version of rollup-plugin-commonjs to =3.0.2, so that my builds keep working.
I have not yet found the time to set up a full reproduction case, but this is the general idea:
- Create
foo.jsand bundle it with browserify. (In practice, we'd get the bundledfoo.jsfrom an npm dependency.) - Create
bar.jsthatimports from the builtfoo.jsand bundle it with rollup. - Load
bar.jsinside a browser.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels