-
Notifications
You must be signed in to change notification settings - Fork 59
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
Default "include" option fails for monorepos #17
Comments
Hrm. This issue might actually be “why doesn’t @rollup/plugin-inject correctly replace Sorry I might have jumped the gun filing thing this. Digging more. |
global
@fionawhim You just saved me a lot of time trying to get to the bottom of this, thank you! It seems
It's a bit nasty, but a lot better than my previous workaround :D |
This was a real nasty one! With no error, for no apparent reason, `container.js` would contain references to `process` (the Node.js built-in), called by a transitive dependency of podigree. The relevant change is in rollup.config.js, the rest is babbling. Turns out rollup-plugin-node-polyfills (which is unmaintained...) hard codes the path to node_modules, and doesn't follow symlinks within node_modules. Charming... The current workaround fixes it for now, but for Yarn 2's Plug'n'Play linking, we'd need another workaround yet. There's an issue in the rollup-plugin-node-polyfills project for this, but since it's dead, it probably won't be fixed. Still, the author of that issue probably saved us hours: ionic-team/rollup-plugin-node-polyfills#17 Important: There is currently no regression test for this. Presumably the orodruin/example tests will cover this (once fixed), but for now it can only be tested manually. Once those tests are fixed, we need to see if reverthing this fix breaks them, as expected.
[heavily edited to match what the source of the bug is]
The default
include
option that’s passed torollup-plugin-inject
,'node_modules/**/*.js'
, causes problems when working in a monorepo wherenode_modules
dependencies are hoisted above the current working directory whererollup
is run.The
include
ends up getting resolved relative to the current directory, even though the Node resolution might find modules in anode_modules
directory in a parent.For me, this manifested in the
buffer-es6.js
’sglobal
not getting converted into its own polyfill, which caused anUncaught ReferenceError: global is not defined
error.A workaround is to manually specify an
include
option to therollup-plugin-node-polyfills
.The text was updated successfully, but these errors were encountered: