Open lygstate opened 2 years ago
Self-reference only works with the "exports" or "imports" field, which this plugin doesn't yet support.
You shouldn't be able to self-require the package otherwise.
Yarn workspaces, and I assume npm and pnpm workspaces too, installs all local packages to node_modules/package-name
.
In the tests of a package I want to reference the built package. The file
packages/my-package/__tests__/my-package.test.js
imports my-package
(resolving to packages/my-package/dist/index.js
), which triggers import/no-extraneous-dependencies
.
@jacobrask yes, in that case it should Just Work. If it doesn't, and you can run the node
repl and require.resolve(specifier)
works, then please file a separate issue.
@rhangai bundleDependencies is for publishing packages that vendor in node_modules - i'd suggest avoiding it.
Self-referencing only works in node via the "exports" or "imports" fields, which this package (via resolve
) does not yet support - but will hopefully, soon.
It should not be expected to work otherwise.
In my case, since it is a custom rollup project, it works as expected, but I get your point, deleting my comments to prevent bad practices/habits. :+1:
Self-referencing only works in node via the "exports" or "imports" fields, which this package (via
resolve
) does not yet support - but will hopefully, soon.It should not be expected to work otherwise.
@ljharb Do we have an idea on when this will be added to this plugin? or waiting on someone to contribute this?
@rmarkins-godaddy it needs to be added to resolve
, and i'm working on the reverse algorithm for list-exports
first to serve as test fixtures.
Since it's a best practice to make packages backwards-compatible to pre-exports node, i'd hope this feature gap is minimally impactful in the meantime.
What's the status on this? It's already been a year and it seems to be still unsolved. I would have to guess that resolve
still doesn't support it?
@lxsmnsyc it's been 4 years since node shipped "exports", and yes, resolve
still doesn't support it.
@ljharb how is resolve
different from, say, resolve.exports
package? or is it possible to transition to it?
There's a lot of functionality we'd need - in particular, we'd need the ability to lint against a particular version of node's support, and nothing in the ecosystem provides that (resolve
, however, will).
No matter how much longer it takes, I'm unlikely to switch from resolve
.
Error: