ionic-team / ionic-team/rollup-plugin-node-polyfills
Default "include" option fails for monorepos
- Vorherrschende Sprache
- JavaScript
- Sterne
- 142
- Forks
- 65
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
[heavily edited to match what the source of the bug is]
The default `include` option that’s passed to `rollup-plugin-inject`, `'node_modules/**/*.js'`, causes problems when working in a monorepo where `node_modules` dependencies are hoisted above the current working directory where `rollup` is run.
The `include` ends up getting resolved relative to the current directory, even though the Node resolution might find modules in a `node_modules` directory in a parent.
For me, this manifested in the `buffer-es6.js`’s `global` not getting converted into its own polyfill, which caused an `Uncaught ReferenceError: global is not defined` error.
A workaround is to manually specify an `include` option to the `rollup-plugin-node-polyfills`.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Start by tracing how the default include option is passed to rollup-plugin-inject by rollup-plugin-node-polyfills, then reproduce the behavior with a monorepo whose dependencies are hoisted. Done means the default handling finds the hoisted dependency and converts buffer-es6.js's global reference without requiring a manually specified include option.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- build-system, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100