Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@
"disabledDependencies": {
"bundlesize": "0.18.x"
},
"exports": {
".": {
"module": "./lib/index.js",
"module-sync": "./lib/index.js",
"require": "./lib/bundle.umd.js",
"default": "./lib/index.js"
}
},
"bundlesize": [
{
"name": "apollo-link-rest",
Expand Down
4 changes: 4 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ node -e "var package = require('./package.json'); \
package['jsnext:main'] = 'index.js'; \
package['react-native'] = 'index.js'; \
package.typings = 'index.d.ts'; \
package.exports['.'].module = './index.js'; \
package.exports['.']['module-sync'] = './index.js'; \
package.exports['.'].require = './bundle.umd.js'; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is the .umd.js extension.

image

As weird as it sounds, the name of this file would need to be

-./bundle.umd.js
+./bundle.umd.cjs

for this to work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we skip the type: module, and all other files are renamed to mjs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing @phryneas! My first reaction is to go with the .cjs extension, because I believe that tagging this with ”type”: “module” is considered best practice & it sounds like an easy fix, but I don’t actually know for sure.

What do you think @jerelmiller ?

package.exports['.'].default = './index.js'; \
var origVersion = 'local';
var fs = require('fs'); \
fs.writeFileSync('./npm/package.json', JSON.stringify(package, null, 2)); \
Expand Down
Loading