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

Setting __webpack_public_path__ does not reflect while importing images #2673

Closed
adithyan opened this issue Jun 20, 2016 · 2 comments
Closed

Comments

@adithyan
Copy link

Hello,

In my entry(main.js) file I have set __webpack_public_path__ at the first line as below

__webpack_public_path__ = 'http://some.cdn.com/some'

but while import images it just return the name

import SomeFriend from '../../images/some-friend';
(the above import is done in b.js which will be imported in main.js)

I even tried it setting next to the import

__webpack_public_path__ = 'http://some.cdn.com/some'
import SomeFriend from '../../images/some-friend';

when I do console.log(SomeFriend) it returns the file name as some-friend.jpg

Need experts advice. How to set __webpack_public_path__ so that all my image will be loaded from the give location.

Thanks & Regards
Adi

@sokra
Copy link
Member

sokra commented Jun 20, 2016

import is hoisted, so it always runs before the code inside of your module.

You probably have the use require in the entry point.

@adithyan
Copy link
Author

Great it works,
Thanks quick response.

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

2 participants