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

external.indexOf is not a function #263

Closed
viveleroi opened this issue Dec 11, 2017 · 2 comments
Closed

external.indexOf is not a function #263

viveleroi opened this issue Dec 11, 2017 · 2 comments

Comments

@viveleroi
Copy link

Rollup allows external to be a function. However, after adding this plugin, an error is thrown:

[!] TypeError: options$1.external.indexOf is not a function
TypeError: options$1.external.indexOf is not a function
    at isExternal (.../node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js:730:86)
    at .../node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js:734:46
    at .../node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js:631:32
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:684:11)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:613:3
@viveleroi
Copy link
Author

viveleroi commented Dec 11, 2017

Looking into this more, it turns out that another plugin being added after this was modifying the options.external property. The real issue is that when this logic first runs, Array.isArray( options$1.external ) might be true, but might not be when the isExternal logic runs.

I've changed the order of my plugins and it seems to work fine, but this feels like an easy thing to check against.

@adrianheine
Copy link
Contributor

Yeah, the Array.isArray( options.external ) could be moved inside the arrow function, so that if options.external already is a function, there's still a wrapper function added. I wouldn't trust these options to not change during runtime, either.

This issue was closed.
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

2 participants