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

__VERSION__ undefined when import from node_modules #4

Open
lokhmakov opened this issue Aug 19, 2016 · 6 comments
Open

__VERSION__ undefined when import from node_modules #4

lokhmakov opened this issue Aug 19, 2016 · 6 comments

Comments

@lokhmakov
Copy link

lokhmakov commented Aug 19, 2016

  1. Simple import with webpack build return error in subj
    import HumanInput from 'humaninput' const hi = new HumanInput(window) hi.on('a', () => console.log(12345))
  2. U r using webpack DefinePlugin for defining __VERSION__
  3. main in package.json reference to lib/humaninput-full.js, where no __VERSION__
  4. In dist/humaninput-1.1.12.full.js all is ok
@liftoff
Copy link
Owner

liftoff commented Aug 26, 2016

Any suggestions on how to fix this? Also, I'm not sure how to test it either. I thought node used requirejs and didn't support native ES6 modules yet?

@lokhmakov
Copy link
Author

1 way (simple and fast)

you can reference in package.json to dist/humaninput-full.min.js

2 way

Don't use VERSION from package.json (define const by yourself) or dont use VERSION at all in code

3 way (insecure)

Import package.json and use VERSION realtime

4 way (the best)! :)

Reconfigure ur make scripts for Development version to inject VERSION variable as we see in production code:

_this.VERSION = "1.1.12";

@skoch
Copy link

skoch commented Jan 4, 2017

Any resolution on this?

import HumanInput from 'humaninput/dist/humaninput-full.min'; isn't ideal.

@liftoff
Copy link
Owner

liftoff commented Aug 20, 2017

OK I'm still trying to understand this issue and I'm not sure what I need to change. @lokhmakov provided four ways but that's four things I don't understand. "You can reference in package.json"? What does that mean? Change the main variable?

Also, the Makefile already injects the version variable... So obviously it's not doing it in the way you suggest.

Can someone just provide a pull request?

@Septaris
Copy link

Any news ?

@marwie
Copy link

marwie commented May 29, 2018

would be interested as well

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

No branches or pull requests

5 participants