Skip to content
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

fix: get it working with jupyter lab #45

Merged
merged 3 commits into from Feb 25, 2019
Merged

Conversation

maartenbreddels
Copy link
Contributor

Pretty painful experience, the first issue was exporting two plugins this way is not supported in jupyter lab. You need to have a default export with a plugin, or a list of.

The second issue has to do with modules, what I think was going on is this:
The handsontable module, when loaded via requirejs is a amd/commonjs module, it will give you the Handsontable object, not a module with a .default or the Handsontable property.
Basically, it's export value is the Handsontable object.

We created handsontable.ts, and exported it using default, which means that it was using handsontable.default.renderers.registerRenderer.

However, when used from jupyter lab, it was using the real handsontable module, not our handsontable.ts, which means it cannot find .default, since that's an es6 module thing, not the commonjs/amd that appearently was being used in bundling.

Short story, of all options, this seems to do the trick!

@maartenbreddels
Copy link
Contributor Author

One more note, for my memory and future reference:

import Handsontable from 'handsontable';
Handsontable.renderers.registerRenderer
# translates to
const handsontable_1 = require("handsontable");
handsontable_1.default.renderers.registerRenderer

This should work with an es6 module, which handsontable has support for, but for some reason does not work with webpack as configured now.

import {Handsontable} from 'handsontable';
Handsontable.renderers.registerRenderer
# translates to
const handsontable_1 = require("handsontable");
handsontable_1.Handsontable.renderers.registerRenderer
import * as Handsontable from 'handsontable';
Handsontable.renderers.registerRenderer
# translates to
const Handsontable = require("handsontable");
Handsontable.renderers.registerRenderer

And we need the last one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant