vike icon indicating copy to clipboard operation
vike copied to clipboard

Add "module" to package.json exports.

Open mattidupre opened this issue 1 year ago • 1 comments

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 avatar Dec 24 '23 23:12 mattidupre

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

brillout avatar Dec 25 '23 07:12 brillout

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 avatar Mar 18 '24 20:03 brillout

Also, would your company be up for sponsoring?

brillout avatar Mar 18 '24 20:03 brillout

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

mattidupre avatar Mar 27 '24 05:03 mattidupre