max-mapper / websocket-stream

websockets with the node stream API
BSD 2-Clause "Simplified" License
667 stars 114 forks source link

Difficulties when packaging your module with rollup (es6) #124

Closed binarykitchen closed 7 years ago

binarykitchen commented 7 years ago

Trying to switch from gulp to rollup in my videomail-client project but build fails with a websocket-stream related error saying:

'default' is not exported by node_modules/websocket-stream/stream.js

the rollup config I am using is in this incomplete, experimental branch: https://github.com/binarykitchen/videomail-client/blob/feature/rollupjs/env/dev/rollup.config.js

the whole output is

~/c/videomail-client ❯❯❯ yarn build:dev                                                                                                                                                                       ⏎ feature/rollupjs ✭ ✱
yarn build:dev v0.24.5
$ npm run std --silent
$ rollup -c env/dev/rollup.config.js -w 
bundling...
(700): src/wrappers/optionsWrapper.js⚠️   'default' is not exported by 'node_modules/global/window.js'
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
commonjs-proxy:/home/michael-heuberger/code/videomail-client/node_modules/global/window.js (1:137)
1: import * as window from "/home/michael-heuberger/code/videomail-client/node_modules/global/window.js"; export default ( window && window['default'] ) || window;
                                                                                                                                            ^

⚠️   'default' is not exported by 'node_modules/global/document.js'
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
commonjs-proxy:/home/michael-heuberger/code/videomail-client/node_modules/global/document.js (1:145)
1: import * as document from "/home/michael-heuberger/code/videomail-client/node_modules/global/document.js"; export default ( document && document['default'] ) || document;
                                                                                                                                                    ^

🚨   'default' is not exported by node_modules/websocket-stream/stream.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
src/wrappers/visuals/recorder.js (3:7)
1: import { Buffer } from "/home/michael-heuberger/code/videomail-client/node_modules/buffer-es6/index.js";
2: 
3: import websocket from 'websocket-stream';
          ^
4: import Frame from 'canvas-to-buffer';
5: import util from 'util';

Done in 12.99s.
  1. have you every managed to rollup an es6 enabled project with this library?
  2. is there anything suspicious?
  3. does websocket-stream come with a default export or will i have to tweak this with the namedExports option https://github.com/rollup/rollup-plugin-commonjs#custom-named-exports ?
mcollina commented 7 years ago

Unfortunately no, and I have never used rollup as well.