Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

require is not defined in v3.3.0 #83

Closed
martinhecher opened this issue Jul 22, 2016 · 2 comments
Closed

require is not defined in v3.3.0 #83

martinhecher opened this issue Jul 22, 2016 · 2 comments

Comments

@martinhecher
Copy link

We are running into a regression with v3.3.0 when creating an UMD bundle that includes the NPM module oauthio-web.

Including the UMD bundle in a web page results in this error:

Uncaught ReferenceError: require is not defined

I created a repository to demonstrate the error:

https://github.com/Redsift/rollup-common-js-regression

Running

npm install
npm start

opens a browser window. Opening the index.html there shows the error in the developer console.

The code works fine with v3.0.2.

It seems that this regression could be related to the following code change:

if ( name === 'require' && !scope.contains( name ) ) {

Thanks!

@MattiasBuelens
Copy link
Contributor

I believe this is the same issue as #77.

OAuth.io is built with browserify, which contains typeof require === "function" && require in its UMD wrapper. This plugin breaks that line by replacing typeof require without actually providing a valid require function.

@Rich-Harris
Copy link
Contributor

Sorry for the epic wait – fixed in 5.0.2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants