{"action":"created","issue":{"url":"https://api.github.com/repos/sebastian-software/rollup-plugin-rebase/issues/15","repository_url":"https://api.github.com/repos/sebastian-software/rollup-plugin-rebase","labels_url":"https://api.github.com/repos/sebastian-software/rollup-plugin-rebase/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/sebastian-software/rollup-plugin-rebase/issues/15/comments","events_url":"https://api.github.com/repos/sebastian-software/rollup-plugin-rebase/issues/15/events","html_url":"https://github.com/sebastian-software/rollup-plugin-rebase/issues/15","id":373517894,"node_id":"MDU6SXNzdWUzNzM1MTc4OTQ=","number":15,"title":"Imports of assets are in relation to the importer, however they are always copied in relation to the output folder.","user":{"login":"sebinsua","id":152098,"node_id":"MDQ6VXNlcjE1MjA5OA==","avatar_url":"https://avatars2.githubusercontent.com/u/152098?v=4","gravatar_id":"","url":"https://api.github.com/users/sebinsua","html_url":"https://github.com/sebinsua","followers_url":"https://api.github.com/users/sebinsua/followers","following_url":"https://api.github.com/users/sebinsua/following{/other_user}","gists_url":"https://api.github.com/users/sebinsua/gists{/gist_id}","starred_url":"https://api.github.com/users/sebinsua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebinsua/subscriptions","organizations_url":"https://api.github.com/users/sebinsua/orgs","repos_url":"https://api.github.com/users/sebinsua/repos","events_url":"https://api.github.com/users/sebinsua/events{/privacy}","received_events_url":"https://api.github.com/users/sebinsua/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-10-24T14:39:02Z","updated_at":"2018-12-17T16:16:02Z","closed_at":null,"author_association":"NONE","body":"Hello fellow Sebastian,\r\n\r\nI found a bug.\r\n\r\n[Imports of assets are in relation to the importer, however they are always copied in relation to the output folder.](https://github.com/sebastian-software/rollup-plugin-rebase/blob/master/src/index.js#L108-L114)\r\n\r\nTo be more wordy:\r\n\r\n> `files[fileSource]` is set to point towards `path.join(folder, fileTarget)` while `assetId` is set to point towards the same thing but prefixed with `path.dirname(importer)`. That means if the import is within a folder, the import of the asset will be relative to this, while the file will be copied to a folder that is not relative to this.\r\n> \r\n> For example, I have an image `TestComponent/image.png` that is imported by a `TestComponent/Component.js`. The `assetId` becomes the absolute path of `./TestComponent/${folder}/${hash}.png`, while `files[fileSource]` points towards `${folder}/${hash}.png`.\r\n\r\nI've created a reproduction and unit test for you here: https://github.com/sebinsua/rollup-plugin-rebase/tree/fix/asset-location-within-bundle-output-when-importer-is-deep\r\n\r\nI believe the change which would have caused this bug happened here: https://github.com/sebastian-software/rollup-plugin-rebase/commit/a29bf4780ea9434752270cecd5209827cdc3f83c\r\n\r\n> **NOTE:** One other unrelated thing which didn't work well with my team's coding style, was that by default you `exclude` instead of only `include`ing certain file types. I would try to explicitly include the file extensions you wish to handle, since otherwise imports like `import cssInJsStyles from './blah.styles'` do not get filtered out and cause unexpected build time errors."},"comment":{"url":"https://api.github.com/repos/sebastian-software/rollup-plugin-rebase/issues/comments/447902546","html_url":"https://github.com/sebastian-software/rollup-plugin-rebase/issues/15#issuecomment-447902546","issue_url":"https://api.github.com/repos/sebastian-software/rollup-plugin-rebase/issues/15","id":447902546,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzkwMjU0Ng==","user":{"login":"swernerx","id":145201,"node_id":"MDQ6VXNlcjE0NTIwMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/145201?v=4","gravatar_id":"","url":"https://api.github.com/users/swernerx","html_url":"https://github.com/swernerx","followers_url":"https://api.github.com/users/swernerx/followers","following_url":"https://api.github.com/users/swernerx/following{/other_user}","gists_url":"https://api.github.com/users/swernerx/gists{/gist_id}","starred_url":"https://api.github.com/users/swernerx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swernerx/subscriptions","organizations_url":"https://api.github.com/users/swernerx/orgs","repos_url":"https://api.github.com/users/swernerx/repos","events_url":"https://api.github.com/users/swernerx/events{/privacy}","received_events_url":"https://api.github.com/users/swernerx/received_events","type":"User","site_admin":false},"created_at":"2018-12-17T16:16:02Z","updated_at":"2018-12-17T16:16:02Z","author_association":"MEMBER","body":"Thanks for your time - can you check whether the current repository version fixes your issue? Thanks a lot!"}}
{"actor":{"display_login":"swernerx"}}