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

Add "module" to package.json exports. #1382

Closed
mattidupre opened this issue Dec 24, 2023 · 4 comments
Closed

Add "module" to package.json exports. #1382

mattidupre opened this issue Dec 24, 2023 · 4 comments
Labels
enhancement ✨ New feature or request

Comments

@mattidupre
Copy link

Description

Happy holidays!

Is there a reason why module is not one of the defined exports in the Vike package.json? vike/server currently has the following exports:

      "worker": "./dist/esm/node/runtime/index.js",
      "edge-light": "./dist/esm/node/runtime/index.js",
      "require": "./dist/cjs/node/runtime/index.js",
      "node": "./dist/esm/node/runtime/index.js",
      "browser": "./dist/esm/client/node.js",
      "types": "./dist/esm/node/runtime/index.d.ts"
}

Adding "module": "./dist/esm/node/runtime/index.js" wouldn't take precedence over any of the others would it? Lost some time with this while bundling a dependency of Netlify functions. For now my workaround is to use Rollup with @rollup/plugin-node-resole options set to { exportConditions: ['node'] }.

@mattidupre mattidupre added the enhancement ✨ New feature or request label Dec 24, 2023
@brillout
Copy link
Member

Good question. I think the exports can indeed be improved. I'm not sure node + require is the most future-proof way. Suggestions?

@brillout
Copy link
Member

Done: I just added "default" exports. I think it's a more robust approach than "module", and I presume it addresses the issue you had.

@brillout
Copy link
Member

Also, would your company be up for sponsoring?

@mattidupre
Copy link
Author

Woop woop, appreciate it @brillout! I'll keep my eyes open for sponsors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants