-
Notifications
You must be signed in to change notification settings - Fork 31
webpack issue "import and export may only appear at the top level" #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Would be really helpful for contributors to be on the same page. Not exactly sure why but it seems that
Produces
2.79kb. (function webpackUniversalModuleDefinition(root, factory) {
... webpack stuff ...
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports) {
import Promise from 'bluebird';
import rethinkdb from 'rethinkdb';
import protodef from 'rethinkdb/proto-def';
import {configureTcpPolyfill} from './TcpPolyfill';
function connect({host, port, path, secure, wsProtocols, db, simulatedLatencyMs}) {
configureTcpPolyfill({path, secure, wsProtocols, simulatedLatencyMs});
// Temporarily unset process.browser so rethinkdb uses a TcpConnection
const oldProcessDotBrowser = process.browser;
process.browser = false;
const connectOptions = {host, port, db};
const connectionPromise = Promise.promisify(rethinkdb.connect)(connectOptions);
process.browser = oldProcessDotBrowser;
return connectionPromise;
}
const RethinkdbWebsocketClient = {
rethinkdb,
protodef,
Promise,
connect,
};
export {
rethinkdb,
protodef,
Promise,
connect,
RethinkdbWebsocketClient as default,
};
/***/ }
/******/ ])
}); Babel didn't operate. |
Hmm.. seems that in this line https://github.com/mikemintz/rethinkdb-websocket-client/blob/master/webpack/base.config.js#L19 removing In what scenario do we want exclude for |
@babakness, I'm using the latest master, and I don't think I'm seeing the same behavior as you. I.e. I clone this project from git, run
|
Not sure why. It seems that the main difference might be the version of Node? Also, I'm on a Mac. After I removed In my private fork I included the |
I'm using node 6.5.0 on linux, but I have also gotten it working on node 0.12, node 4, and node 5. Does your dist/node.js file also have ES6, or is it only dist/index.js? The unit tests in I saw the trailing spaces issue as well and made a commit to fix that, but I don't think that made a difference for the ES5/6 issue on my end. |
npm run prepublish
doesn't produce the sameindex.js
indist
that one gets fromnpm install rethinkdb-webdocket-client
. The version ofdist/index.js
vianpm install
is in es5, the one produced by the local webpack config is in es6 with stated issues. No biggie but seems like an update to scripts in package.json makes sense.The text was updated successfully, but these errors were encountered: