profile
viewpoint

Ask questionsnode v13.0-v13.1 errors on require of a module with "exports" defined

I get this error: Error: Package exports for 'path/to/package' do not define a valid '.' target

when, in the node v13.1 repl (where the flag should be required), I have:

     "main": "index",
     "exports": {
         ".": {
             "default": "./node.js"
         }
     },

I would have expected "exports" to have no effect prior to v13.2 when no modules flag is provided. It throws for me on v13.0 and v13.1, although not on v12.

This seems like a pretty serious back compat issue.

nodejs/modules

Answer questions MylesBorins

Tbh I don't think that is something we should care about. Yes we should ensure the changes we make are not semver major, but this is an experimental feature and those are unsupported releases at this point

On Mon, Nov 25, 2019, 2:08 PM Jordan Harband notifications@github.com wrote:

No issues I can find with v12.

I don't mean, a back compat issue that we could fix in older v13 minors (altho that would be ideal), i mean an issue with keeping "exports" moving forward, because it means any package that uses the object form can never work on those two minors of node.

Is there any version of the object form that will work on v13.0 and v13.1?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nodejs/modules/issues/446?email_source=notifications&email_token=AADZYVZBQEXGHJ3WHN7CLNDQVQPBBA5CNFSM4JRNKIGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFDO6VY#issuecomment-558296919, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADZYV7GSPFR7JCVM7UZSQ3QVQPBBANCNFSM4JRNKIGA .

useful!

Related questions

Transition Path Problems For Tooling hot 1
Proposal: Support loading package by own "name" hot 1
JSON modules are being reverted on web hot 1
Out-of-Band Meeting Proposal hot 1
Use consistent error codes for MODULE_NOT_FOUND hot 1
Out-of-Band Meeting Proposal hot 1
Loader Hooks hot 1
Proposal: Support loading package by own "name" hot 1
Github User Rank List