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
External modules are resolved / re-written instead of being ignored #609
Comments
Note: if I do this:
... then this works as expected, but I'm not sure why that should be the case, when Rollup's examples use |
We're going to have a new version of node-resolve out (in what I hope is a few days) and I believe it may solve this problem. |
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ |
Please re-open! This is still an issue as of |
Are there also no workarounds to this issue? |
Given the age of the issue and the updates made to the plugin since, please open a new issue with your reproduction. |
Hi @matthew-dean I think the reason this happens is because the In your repl for example What you want to happen is Wondering if there's a nice way to solve this. |
Got a fix. Will open PR shortly and reopening this issue because I'll reference it in the PR. |
@tjenkinson Thanks for looking at it! Through trial and error, I was indeed able to get node resolve to not re-write imports by being explicit about each one and doing something like:
vs
What was confusing about that is that |
Spoke a bit too soon. Opened the draft PR but tests are hanging. I think there might be an issue where |
Figured out why it fails (#799 (comment)). Not sure how to work around that yet 🤔 |
@matthew-dean curious though, if you’re treating everything in node_modules as external why do you need the plugin? |
…ernal (#799) BREAKING CHANGES: Now requires rollup@^2.42.0 * fix(node-resolve): mark module as external if resolved module is external fixes #609 * don't use ?. * prevent infinite loops * check both importee and importer in nested this.resolve and add more tests * upgrade to rollup 2.42.0 to simplify nested `this.resolve`
…ernal (#799) BREAKING CHANGES: Now requires rollup@^2.42.0 * fix(node-resolve): mark module as external if resolved module is external fixes #609 * don't use ?. * prevent infinite loops * check both importee and importer in nested this.resolve and add more tests * upgrade to rollup 2.42.0 to simplify nested `this.resolve`
I think this change might be breaking resolution for modules that aren't directly in Here is a snippet of my resolve({
modulesOnly: true,
dedupe: ['firebase'],
}),
resolve({
// preact@10 is failing `modulesOnly: true`. TODO: find out why.
resolveOnly: ['preact'],
dedupe: ['preact'],
mainFields: ['module'],
}), and here's the top of my bundle: import { Block, Row } from 'jsxstyle/preact';
import { subscribeToTaskState, connectToFirebase, logStart, logCompletion, logIneligible } from 'endor-remote';
import { assignmentId, getLogHost, LogHost, log } from 'firebreather';
import { makeExperiment } from 'firebreather-preact'; The top import is in v13.0.0 is the plugin version that breaks my project. Its changelog sent me here. |
Expected Behavior
Actual Behavior
/node_modules/
path. This prevents the Rollup-bundled library from being imported as a module into another repo, as dependencies will not be local to the original repo, they will be installed as dependencies in the importing repo.For example this line:
import axios from 'axios'
should remain:
import axios from 'axios'
Instead, it turns into:
import axios from './node_modules/axios/index.js';
Additional Information
Any temporary workarounds to this behavior would be welcome.
The text was updated successfully, but these errors were encountered: