Skip to content

Commit

Permalink
change jsnext:main to browser
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Apr 30, 2016
1 parent 92b7798 commit 9c18d33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.7.3",
"description": "IPFS Repo implementation",
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"browser": "src/index.js",

This comment has been minimized.

Copy link
@daviddias

daviddias May 1, 2016

Author Member

@dignifiedquire @Voxelot @jbenet

When npm link'ing, Webpack will try to load lib/index.js instead of src/index.js, unless I tag this as browser.

Doesn't seem that jsnext:main is supported anymore on WebPack https://github.com/webpack/webpack/blob/master/lib/WebpackOptionsDefaulter.js#L83-L88

Note however that, when npm installing this module, it will still try to load the lib version, giving the $export error on js-ipfs-unixfs-engine because it is trying to transpile the already very transpiled version

This comment has been minimized.

Copy link
@dignifiedquire

dignifiedquire May 2, 2016

Member

We have been always using the lib version since we started using aegir, so we don't have to transpile things inside node_modules. I'm not sure what exactly is happening now/why this started to break down.

This comment has been minimized.

Copy link
@daviddias

daviddias May 2, 2016

Author Member

Why do we have jsnext:main then? Thought that was to tell WebPack to use the non transpiled version

This comment has been minimized.

Copy link
@dignifiedquire

dignifiedquire May 2, 2016

Member

Some references as to why I suggested exposing it:

at the moment it is not enabled by default in webpack, but it can be so at any point in time via a configuration option.

This comment has been minimized.

Copy link
@daviddias

daviddias May 2, 2016

Author Member

Interesting. I thought it was already in place. It seems from the WebPack docs that if we tag it as browser, it does what I was thinking.

Btw, 😧 moment is the fact that js-ipfs has no issues webpacking ipfs-repo ipfs/js-ipfs#156

This comment has been minimized.

Copy link
@dignifiedquire

dignifiedquire May 2, 2016

Member

Oh boy this getting more and more fun.

We shouldn't use browser though, as that is being used for browser specific things to distinguish between node and the browser, which we are not trying to do here.

I suggest we try and figure out a minimal version of when this issue appears so we can file a bug report with webpack as I'm pretty sure by now that the issue is coming from there.

"scripts": {
"test": "aegir-test",
"test:node": "aegir-test node",
Expand Down Expand Up @@ -61,4 +61,4 @@
"dignifiedquire <dignifiedquire@gmail.com>",
"greenkeeperio-bot <support@greenkeeper.io>"
]
}
}

0 comments on commit 9c18d33

Please sign in to comment.