You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upfront note: I'd be willing to submit a PR to help out with this.
Is your feature request related to a problem? Please describe.
Commit c505822 inadvertantly introduced some breaking changes to subpath exports when Eleventy is consumed as a dependency. By adding the exports key to package.json with only 1 conditional import (import/requre keys), any attempt to import a subpath throws a ERR_PACKAGE_PATH_NOT_EXPORTED error. (source)
Describe the solution you'd like
This is more specific to @11ty/eleventy/src/Engines/Util/ContextAugmenter.js (#3355 (comment)) but is applicable to any exports in Eleventy that could be consumed by outside packages, including (but not limited to):
...however I'm cautious to use that pattern because it's 1) not terribly erganomic, and 2) I'm not sure if there's any resolution errors that could stem from that syntax. In my case specifically, augmentKeys is a 2-element array so my solve is copy-pasting the array into my code to achieve the same result.
Additional context
Subpath exports are supported by Node 18 which is the required minimum for 3.0.
Additionally, when an exports field is present the main field is ignored by Node v12.7.0 and later, so to alleviate any confusion in Node's entry-point resolution, it might be worth removing the "main" key from Eleventy's package.json entirely. (source)
The text was updated successfully, but these errors were encountered:
noelforte
changed the title
Declare subpath exports for bundled plugins, Eleventy-maintained data, etc.
Declare subpath exports for bundled plugins, Eleventy-maintained data, .d.ts typings, etc.
Oct 29, 2024
@Ryuno-Ki yep, I mentioned that issue in my original post. I opened a new issue since while .d.ts files can be referenced through subpath imports, the implementation of subpath imports isn't directly dependent on typings. I'm ok closing in favor of the other issue, but there's my explanation 😄
Upfront note: I'd be willing to submit a PR to help out with this.
Is your feature request related to a problem? Please describe.
Commit c505822 inadvertantly introduced some breaking changes to subpath exports when Eleventy is consumed as a dependency. By adding the
exports
key to package.json with only 1 conditional import (import/requre
keys), any attempt to import a subpath throws aERR_PACKAGE_PATH_NOT_EXPORTED
error. (source)Describe the solution you'd like
This is more specific to
@11ty/eleventy/src/Engines/Util/ContextAugmenter.js
(#3355 (comment)) but is applicable to anyexports
in Eleventy that could be consumed by outside packages, including (but not limited to):.d.ts
declaration files (#3097, #3296)augmentKeys
Syntax I'm thinking of could be something like:
The above declarations can be consumed as so:
Or via an aggregator:
Describe alternatives you've considered
It is possible to import something from a package with an "exports" key directly via
node_modules
, for instance this doesn't throw an error:...however I'm cautious to use that pattern because it's 1) not terribly erganomic, and 2) I'm not sure if there's any resolution errors that could stem from that syntax. In my case specifically,
augmentKeys
is a 2-element array so my solve is copy-pasting the array into my code to achieve the same result.Additional context
Subpath exports are supported by Node 18 which is the required minimum for 3.0.
Additionally, when an
exports
field is present themain
field is ignored by Node v12.7.0 and later, so to alleviate any confusion in Node's entry-point resolution, it might be worth removing the "main" key from Eleventy's package.json entirely. (source)The text was updated successfully, but these errors were encountered: