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

relative import of modules that were build from repo #79

Closed
cvg1 opened this issue Jan 19, 2016 · 9 comments
Closed

relative import of modules that were build from repo #79

cvg1 opened this issue Jan 19, 2016 · 9 comments

Comments

@cvg1
Copy link

cvg1 commented Jan 19, 2016

hello,

can some one help, how to use the master/dev repo modules builds?
after npm run clean && npm run build, i'll get these build results in inferno/dist/ directory:

-rw-r--r-- 1 zst zst   6963 Jan 19 23:29 inferno-component.js
-rw-r--r-- 1 zst zst   3304 Jan 19 23:29 inferno-component.min.js
-rw-r--r-- 1 zst zst 123599 Jan 19 23:29 inferno-dom.js
-rw-r--r-- 1 zst zst  41078 Jan 19 23:29 inferno-dom.min.js
-rw-r--r-- 1 zst zst  19992 Jan 19 23:29 inferno-server.js
-rw-r--r-- 1 zst zst   8303 Jan 19 23:29 inferno-server.min.js
-rw-r--r-- 1 zst zst   9114 Jan 19 23:29 inferno.js
-rw-r--r-- 1 zst zst   3209 Jan 19 23:29 inferno.min.js

however when trying to import modules via relative path:

import Inferno from './static/vendor/inferno/dist/inferno.min.js';
import InfernoDOM from './static/vendor/inferno/dist/inferno-dom.min.js';
import InfernoComponent from './static/vendor/inferno/dist/inferno-component.min.js';

no errors are reported during bundle creation, but inferno component will not get mounted into DOM node specified via getElementByID.
i apologize if the issue is obvious. i am not familiar with front end dev processes.

these are imports specified when packages are installed via npm, which do work ok:

import Inferno from 'inferno';
import InfernoDOM from 'inferno-dom';
import InfernoComponent from 'inferno-component';

note that i believe that i am doing something wrong rather than there is an issue/bug with the actual inferno package.

regards,

@ghost
Copy link

ghost commented Jan 19, 2016

@cvg1 There was a bug in the bundle system. Try latest dev and bundle again. The files are now located in packages/inferno/dist

@cvg1
Copy link
Author

cvg1 commented Jan 20, 2016

i can confirm that packages are being built into path you've specified.
i've altered the relative imports to:

import Inferno from './static/vendor/inferno/packages/inferno/dist/inferno.min.js';
import InfernoDOM from './static/vendor/inferno/packages/inferno/dist/inferno-dom.min.js';
import InfernoComponent from './static/vendor/inferno/packages/inferno/dist/inferno-component.min.js';

however, behavior reminds the same.

@trueadm
Copy link
Member

trueadm commented Jan 20, 2016

This should be all fixed in the latest master/release.

@cvg1
Copy link
Author

cvg1 commented Jan 20, 2016

i've installed now 0.5.18 from npm again and using these imports again:

import Inferno from 'inferno';
import InfernoDOM from 'inferno-dom';
import InfernoComponent from 'inferno-component';

however, the inferno-component import doesn't work anymore:

Error: Cannot find module 'inferno-component' from '/home/zst/app/'

@terinjokes
Copy link
Contributor

@cvg1 this was probably just fixed (after 0.5.18, sorry!) in 2856710.

@trueadm
Copy link
Member

trueadm commented Jan 20, 2016

@cvg1 I applied this fix to master and update the inferno-component NPM module. Should all work fine now.

@cvg1
Copy link
Author

cvg1 commented Jan 20, 2016

ok, i've installed inferno-component from npm and all npm imports work ok now.

i've also tried to build modules from master again. relative import of these two works ok:

import Inferno from './static/vendor/inferno/packages/inferno/dist/inferno.min.js';
import InfernoComponent from './static/vendor/inferno/packages/inferno/dist/inferno-component.min.js';

but during import of:

import InfernoDOM from './static/vendor/inferno/packages/inferno/dist/inferno-dom.min.js';

i'll recieve:

Error: Cannot find module 'inferno' from '/home/zst/app/static/vendor/inferno/packages/inferno/dist'

@trueadm
Copy link
Member

trueadm commented Jan 20, 2016

As a separate node: you can simply require from NPM now as it's up-to-date with the changes that fixed your earlier issues. In terms of loading from static files, I've had countless issues there – I'd advise to use the usual route import Inferno from 'inferno' but selectively choose the Inferno branch in your package.json.

@cvg1
Copy link
Author

cvg1 commented Jan 20, 2016

i've tried doing symlinks to the node_modules/ dir instead of relative imports and it was working well.
thank you. closing as this is acceptable workaround.

@cvg1 cvg1 closed this as completed Jan 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants