{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/file-loader/issues/46","repository_url":"https://api.github.com/repos/webpack/file-loader","labels_url":"https://api.github.com/repos/webpack/file-loader/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/webpack/file-loader/issues/46/comments","events_url":"https://api.github.com/repos/webpack/file-loader/issues/46/events","html_url":"https://github.com/webpack/file-loader/issues/46","id":116777348,"number":46,"title":"How to deal with relative public path","user":{"login":"adcentury","id":1651946,"avatar_url":"https://avatars.githubusercontent.com/u/1651946?v=3","gravatar_id":"","url":"https://api.github.com/users/adcentury","html_url":"https://github.com/adcentury","followers_url":"https://api.github.com/users/adcentury/followers","following_url":"https://api.github.com/users/adcentury/following{/other_user}","gists_url":"https://api.github.com/users/adcentury/gists{/gist_id}","starred_url":"https://api.github.com/users/adcentury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adcentury/subscriptions","organizations_url":"https://api.github.com/users/adcentury/orgs","repos_url":"https://api.github.com/users/adcentury/repos","events_url":"https://api.github.com/users/adcentury/events{/privacy}","received_events_url":"https://api.github.com/users/adcentury/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2015-11-13T14:23:38Z","updated_at":"2016-07-13T03:57:28Z","closed_at":null,"body":"I set a relative public path in outputs\r\n```\r\noutput: {\r\n  path: path.join(__dirname, 'www/static'),\r\n  filename: '[hash].bundle.js',\r\n  publicPath: './'\r\n}\r\n```\r\n\r\nThen the file structure is like\r\n```\r\nwww\r\n  |-- static\r\n          | -- bundle.js\r\n          | -- some-image.png\r\n          | -- some-other-image.png\r\n          | -- style.css\r\n  |-- index.html\r\n```\r\n\r\nWhen i require image in css, i works fine.\r\n\r\nBut when i require image in some js, the url is wrong.\r\n\r\n```\r\nconst url = require('path/to/some-image.png');\r\n// the url will be 'some-image.png'\r\n// but this url will be used in index.html (through react)\r\n```\r\n\r\nAny one can help me with it? Thanks.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/webpack/file-loader/issues/comments/232250336","html_url":"https://github.com/webpack/file-loader/issues/46#issuecomment-232250336","issue_url":"https://api.github.com/repos/webpack/file-loader/issues/46","id":232250336,"user":{"login":"ianfitzpatrick","id":1757912,"avatar_url":"https://avatars.githubusercontent.com/u/1757912?v=3","gravatar_id":"","url":"https://api.github.com/users/ianfitzpatrick","html_url":"https://github.com/ianfitzpatrick","followers_url":"https://api.github.com/users/ianfitzpatrick/followers","following_url":"https://api.github.com/users/ianfitzpatrick/following{/other_user}","gists_url":"https://api.github.com/users/ianfitzpatrick/gists{/gist_id}","starred_url":"https://api.github.com/users/ianfitzpatrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianfitzpatrick/subscriptions","organizations_url":"https://api.github.com/users/ianfitzpatrick/orgs","repos_url":"https://api.github.com/users/ianfitzpatrick/repos","events_url":"https://api.github.com/users/ianfitzpatrick/events{/privacy}","received_events_url":"https://api.github.com/users/ianfitzpatrick/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T03:57:28Z","updated_at":"2016-07-13T03:57:28Z","body":"I'm having the same problem, not using react but vuejs + cordova. \r\n\r\nI tried to setting:\r\n\r\n`assetsPublicPath: '/',`\r\n\r\nHowever the resulting cordova index.html file still ends up with entries like:\r\n\r\n`<script type=text/javascript src=s/tatic/js/app.2a047fb94d3c535a8f2e.js>`\r\n\r\nMy hacky fix is to just write a little shell script (there is probably a proper webpack post-hook way of doing this but I dunno what it is) to replace all instances of `/static/` with `static/` and that fixed the problem for me. But not exactly elegant.\r\n\r\nI crave a better solution, emailed @export-mike to see if he can share his config with us."}}
{"actor":{"display_login":"ianfitzpatrick"}}