Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails confusingly if a plugin's load() method returns a buffer #607

Closed
callumlocke opened this issue Apr 14, 2016 · 0 comments
Closed

Fails confusingly if a plugin's load() method returns a buffer #607

callumlocke opened this issue Apr 14, 2016 · 0 comments

Comments

@callumlocke
Copy link

I made an ad hoc plugin with a load() method. From this load() method, I returned a buffer in some cases, forgetting to call .toString() before returning (common mistake).

Rollup should probably throw a TypeError if a plugin returns anything except a string/null/undefined.

But strangely, when I return a buffer, rollup behaves as if I had returned a string, i.e. it continues to the transforms... except it then passes undefined into the first transform. In my case, this led to the following error:

Cannot read property 'search' of undefined
  at transform in node_modules/rollup-plugin-inject/dist/rollup-plugin-inject.cjs.js:111:12

which comes from this line in rollup-plugin-inject:

            if ( code.search( firstpass ) == -1 ) return null;
Rich-Harris added a commit that referenced this issue Apr 28, 2016
sanity check output of load hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants