-
Notifications
You must be signed in to change notification settings - Fork 96
An option to use the "browser" and "esnext:browser" fields in package.json #8
Comments
Have opened #14. It only adds support for |
Not yet, it was for symmetry... Weren't you the ones who came up with |
|
It's worth mentioning that Webpack and Browserify both seem to treat the |
My use case is a WIP CSS auto-prefixer library for my CSS in JS library. Server-side, I'll use a autoprefix derivative, and on the client something based on the much lighter (but browser-only) prefixfree... I also would like to offer the client library in both CommonJS and ES6 form (the latter in order to take advantage of Rollup's tree shaking)... How would I achieve that without |
FWIW, if we ever export Question: is there any reason we couldn't just use the pre-existing |
@nolanlawson For the same reason that we cannot use |
@Victorystick, right, but the |
Just a quick note that I can confirm that the "browser" switch is at least working for me when I use |
If you have something like: "main": "lib/index.js",
"jsnext:main": "src/index.js"
"browser": { "./lib/http.js": "./lib/http-browser.js" } where |
I second @letmaik's question—how can I support bundling ES6 and CJS modules for Node and the browser? Seems like
(Note that my package is not isomorphic, that’s why I'm using the |
Actually let's move this discussion to #60. |
You can accomplish this by just putting all switches inside "main": "dist/node/index.js",
"jsnext:main": "dist/node/index.es2015.js",
"browser": {
"dist/node/index.js": "dist/browser/index.js",
"dist/node/index.es2015.js": "dist/browser/index.es2015.js"
} |
Neat @nolanlawson, it's nice to have a single That does presume that How would you handle this case without |
@wearhere I feel like this is an issue with legacy and it's not going anywhere because by the time you convince everyone to write and support a spec, the issue will be resolved (i.e. it's easier to refactor your node module into a ES6 module) |
Previously: rollup/rollup#185
It would be nice to get this.
Edit: wrong issue.
The text was updated successfully, but these errors were encountered: