-
Notifications
You must be signed in to change notification settings - Fork 29
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
ES6 default imports are broken in ParcelJS #21
Comments
I think this is Parcel not working correctly. antd/lib/button is a commonjs module by all means |
It looks like it is using ES6 import/export syntax And according to parcel-bundler/parcel#1584 (comment) that import shouldn't work as it is not to spec. |
@johnhaley81 you need to check the generated source. antd/lib/button is a commonjs module. I can't remember why I chose commonjs format of antd instead of es6 (it ships both format) |
So I did some more research on what was happening and came across some madness. How Import is breakingI'm using This gives me an // Generated by BUCKLESCRIPT VERSION 4.0.6, PLEASE EDIT WITH CARE
import * as Js_option from "bs-platform/lib/es6/js_option.js";
import * as Js_mapperRt from "bs-platform/lib/es6/js_mapperRt.js";
import * as ReasonReact from "reason-react/src/ReasonReact.js";
import * as Js_primitive from "bs-platform/lib/es6/js_primitive.js";
import * as Button from "antd/lib/button"; When we import function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
} Now, this is breaking because 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _button = require('./button');
var _button2 = _interopRequireDefault(_button);
var _buttonGroup = require('./button-group');
var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
_button2['default'].Group = _buttonGroup2['default'];
exports['default'] = _button2['default'];
module.exports = exports['default']; Note the last line where ConclusionCurrently, additional steps are required if the user is using bsb to compile to es6. WorkaroundCurrently you can fix this by bringing in Possible fix?Would it be possible to switch the bindings to all use |
@johnhaley81 Does jsx3 help this situation at all? Enalmada#2 |
👋
Thanks for the bindings.
I tried to use them in a project that was bundled with ParcelJS and it wasn't able to use the bindings as they are defined. The default export is not pulled in correctly. For example, changing a binding from:
to:
Fixed the issue.
The text was updated successfully, but these errors were encountered: