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

require("dom4") in esm code #3256

Closed
r-laf opened this issue Dec 23, 2018 · 3 comments
Closed

require("dom4") in esm code #3256

r-laf opened this issue Dec 23, 2018 · 3 comments

Comments

@r-laf
Copy link

r-laf commented Dec 23, 2018

ReferenceError: Can't find variable: require in ./node_modules/@blueprintjs/core/lib/esm/index.js

where the error code is like

if (typeof window !== "undefined" && typeof document !== "undefined") {
    // we're in browser
    // tslint:disable-next-line:no-var-requires
    require("dom4"); // only import actual dom4 if we're in the browser (not server-compatible)
    // we'll still need dom4 types for the TypeScript to compile, these are included in package.json
}

Environment

"@blueprintjs/core": "^3.10.0",
safari on macOS Mojave

Expected behavior

'require' should not be in esm code

@r-laf r-laf changed the title require("dom4") in require("dom4") in esm code Dec 23, 2018
@r-laf
Copy link
Author

r-laf commented Dec 23, 2018

it seems a dummy "require()" can work

@giladgray
Copy link
Contributor

ooh interesting yeah makes sense this would happen. don't think we can do anything about it without an API break though. upgrading to typescript 3 and using import() would work, but the semantics are quite different. will track solving this soon.

@adidahiya
Copy link
Contributor

This was fixed by #3868, I don't think we need to change anything here at the moment.

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

3 participants