Skip to content
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

esm implementation is breaking for some node versions #1476

Closed
panva opened this issue Jun 29, 2020 · 4 comments
Closed

esm implementation is breaking for some node versions #1476

panva opened this issue Jun 29, 2020 · 4 comments

Comments

@panva
Copy link
Contributor

panva commented Jun 29, 2020

Node.js versions between 13.0.0 and 13.6.0 still had larger bugs in their ESM implementations and the esm wrapper breaks requiring koa the regular way on those runtimes.

❯ node           
Welcome to Node.js v13.0.0.
Type ".help" for more information.
> require('koa')
Thrown:
Error: Package exports for '/Users/panva/repo/provider/node_modules/koa' do not define a valid '.' target
    at resolveExportsTarget (internal/modules/cjs/loader.js:455:13)
    at resolveExports (internal/modules/cjs/loader.js:388:16)
    at Function.Module._findPath (internal/modules/cjs/loader.js:487:20)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:782:27)
    at Function.Module._load (internal/modules/cjs/loader.js:688:27)
    at Module.require (internal/modules/cjs/loader.js:850:19)
    at require (internal/modules/cjs/helpers.js:74:18) {
  code: 'MODULE_NOT_FOUND'
}
> 
❯ node          
Welcome to Node.js v13.6.0.
Type ".help" for more information.
> require('koa')
Uncaught:
Error: No valid exports main found for '/Users/panva/repo/provider/node_modules/koa'
    at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)
    at applyExports (internal/modules/cjs/loader.js:502:14)
    at resolveExports (internal/modules/cjs/loader.js:551:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)
    at Function.Module._load (internal/modules/cjs/loader.js:855:27)
    at Module.require (internal/modules/cjs/loader.js:1033:19)
    at require (internal/modules/cjs/helpers.js:72:18) {
  code: 'MODULE_NOT_FOUND'
}

I've ran into this in the past and know that for those node versions this is an unfixable problem so I don't have a suggestion for a way forward, just wanted to let you know.

For me this means changing my CI test matrix to test "low 13" with 13.7.0 instead 13.0.0 and have my fingers crossed.

This was merged in #1474

@panva
Copy link
Contributor Author

panva commented Jun 29, 2020

I'd appreciate this breaking change be rolled back but as 13.x isn't a supported node release line, i understand if you won't. At the same time, the package.json engines no longer holds true and updating it is technically a breaking change too.

@dead-horse
Copy link
Member

Unfortunately, if there is no way to fix these problematic node versions, even if we roll back the change, there will still be problems the next time we add this support.

@dead-horse
Copy link
Member

I'll close this issue for now because we can do nothing about this, if there are any suggestions, welcome to comment or reopen it. :(

@plh97
Copy link

plh97 commented Dec 9, 2020

run in docker file

FROM node:12.13.0
COPY . /app
WORKDIR /app
RUN npm i
RUN yarn add koa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants