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

Module not properly exported #59

Closed
alexcanana opened this issue Jan 17, 2019 · 1 comment
Closed

Module not properly exported #59

alexcanana opened this issue Jan 17, 2019 · 1 comment

Comments

@alexcanana
Copy link
Contributor

alexcanana commented Jan 17, 2019

Versions
BulmaJS: 0.7.0
Browser: irrelevant
Operating system: irrelevant

Describe the bug
Hello, I think there's a problem in the way you export the module. When I follow the documentation, I get the following error:

Uncaught TypeError: _bulmajs2.default.create is not a function

I think it's because you don't export the module properly on bulma.js.

Also, I think you should remove window.Bulma = Bulma; from the same file. This should be left to the user to decide. And, if you import the library this way import '@vizuaalog/bulmajs', it will work thanks to the windows assignment thus adding to the confusion.

I can submit a PR if needed.

Thank you!

To Reproduce

import Bulma from '@vizuaalog/bulmajs'

const modalTwo = Bulma.create('modal', {
  element: document.querySelector('#modal-example-2')
})

Produces

Uncaught TypeError: _bulmajs2.default.create is not a function

Fix

On bulma.js add the following line:

export default Bulma

and remove the following line:

window.Bulma = Bulma;

@VizuaaLOG
Copy link
Owner

Good spot! The export is wrong. I also think you're right about the window point. It was originally changed to make it easier to import, but there has been other changes that does make this irrelevant now.

I would really appreciate a PR if you would 👍

VizuaaLOG pushed a commit that referenced this issue Jan 19, 2019
VizuaaLOG pushed a commit that referenced this issue Jun 23, 2019
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

2 participants