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

Issue with require statements for hotkeys. #149

Closed
danthedaniel opened this issue Nov 14, 2016 · 10 comments
Closed

Issue with require statements for hotkeys. #149

danthedaniel opened this issue Nov 14, 2016 · 10 comments

Comments

@danthedaniel
Copy link

Bug Report

  • Package version(s): 1.0.1
  • Browser and OS versions: Chrome 54, Debian Jessie 8.6

I'm using blueprint.js in Rails through the help of the sprockets-commoner gem (which is a replacement for browserify).

Describe the issue:

When importing from @blueprintjs/core, a few require statements provide me with issues. In components/hotkeys/hotkeys.js, lines 27, 34, and 35 need to be commented out, else blueprint will not import.

var common_1 = require("../../common");
var react_1 = require("react");
var React = require("react");
var hotkey_1 = require("./hotkey");
var hotkey_2 = require("./hotkey");
exports.Hotkey = hotkey_2.Hotkey;
exports.KeyCombo = hotkey_2.KeyCombo;
var hotkeysTarget_1 = require("./hotkeysTarget");
// exports.HotkeysTarget = hotkeysTarget_1.HotkeysTarget;
var hotkeyParser_1 = require("./hotkeyParser");
exports.comboMatches = hotkeyParser_1.comboMatches;
exports.getKeyCombo = hotkeyParser_1.getKeyCombo;
exports.getKeyComboString = hotkeyParser_1.getKeyComboString;
exports.parseKeyCombo = hotkeyParser_1.parseKeyCombo;
var hotkeysDialog_1 = require("./hotkeysDialog");
// exports.hideHotkeysDialog = hotkeysDialog_1.hideHotkeysDialog;
// exports.setHotkeysDialogProps = hotkeysDialog_1.setHotkeysDialogProps;

Otherwise I get exceptions like Uncaught TypeError: Cannot read property 'setHotkeysDialogProps' of undefined(…).

@adidahiya
Copy link
Contributor

This looks like an issue with sprokects-commoner... the published JS files are simply the output of the TypeScript compiler when compiling to CommonJS format. They work fine with webpack and browserify.

@danthedaniel
Copy link
Author

Okay, I'll file this as an issue over there - hopefully after I figure out exactly what's broken. Do you have any idea why the require statements for hotkeysTarget and hotkeysDialog are the only ones in the library with issues?

@adidahiya
Copy link
Contributor

nothing sticks out about those specific exports... can you paste the full output of the TypeErrors?

@danthedaniel
Copy link
Author

danthedaniel commented Nov 14, 2016

I don't think it'll be very useful, but here it is:

application-c117704….js:42757 Uncaught TypeError: Cannot read property 'HotkeysTarget' of undefined
    at Object.<anonymous> (http://localhost:3000/assets/application-c117704a8d545f41cb0692da460b599baefaa74f88b727319e636fca7c7167ce.js:42757:119)
    at __commoner_initialize_module__ (http://localhost:3000/assets/application-c117704a8d545f41cb0692da460b599baefaa74f88b727319e636fca7c7167ce.js:4:5)
    at http://localhost:3000/assets/application-c117704a8d545f41cb0692da460b599baefaa74f88b727319e636fca7c7167ce.js:42731:92
    at http://localhost:3000/assets/application-c117704a8d545f41cb0692da460b599baefaa74f88b727319e636fca7c7167ce.js:74392:2(anonymous function) @ application-c117704….js:42757__commoner_initialize_module__ @ application-c117704….js:4(anonymous function) @ application-c117704….js:42731(anonymous function) @ application-c117704….js:74392

@giladgray
Copy link
Contributor

i'll be it's due to circular dependencies between the TS modules, which is fine in the TS compiler but probably not fine in "browserify." i know that some bundlers will return undefined from modules that have circular dependencies.

@danthedaniel
Copy link
Author

@giladgray so is this something that commoner needs to fix, or is it something I need to work around? It sounds like this is expected behavior.

@giladgray
Copy link
Contributor

i don't know, i've never even heard of commoner (ruby died to me years ago) 😢 . given that this causes no troubles in the standard JS tools (webpack and browserify), i'd assume there's something going wrong in commoner itself.

@danthedaniel
Copy link
Author

Looks like it is due to circular dependencies:

Shopify/sprockets-commoner#47

@danthedaniel
Copy link
Author

I'll tack on here that I've made a repo that shows how I've configured blueprintjs, react, and react-router in a rails app: https://github.com/teaearlgraycold/blueprintjs-rails-example

@Ciantic
Copy link

Ciantic commented Apr 12, 2018

I'm getting same error with fuse-box.

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

No branches or pull requests

5 participants