{"action":"created","issue":{"url":"https://api.github.com/repos/rollup/rollup/issues/861","repository_url":"https://api.github.com/repos/rollup/rollup","labels_url":"https://api.github.com/repos/rollup/rollup/issues/861/labels{/name}","comments_url":"https://api.github.com/repos/rollup/rollup/issues/861/comments","events_url":"https://api.github.com/repos/rollup/rollup/issues/861/events","html_url":"https://github.com/rollup/rollup/issues/861","id":171594924,"number":861,"title":"Support static file/asset handling (aka file-loader/url-loader in webpack)","user":{"login":"swernerx","id":145201,"avatar_url":"https://avatars.githubusercontent.com/u/145201?v=3","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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-17T07:46:59Z","updated_at":"2016-08-17T09:27:56Z","closed_at":null,"body":"Using webpack it's possible to define requirements of e.g. a component with imports to static files/assets e.g. fonts, css files, images. I would like to bundle code from a UI library project using rollup but therefor it has to keep the imports for these static file assets in-tact so that these are usable by webpack. Through the fact that bundling also changes relative paths it has to copy references files to the \"lib\" or \"dist\" folder and adjust these references.\r\n\r\nI tried implementing this. What I am currently working on is a node-based [utility for simplifying pre-publishing of libraries](https://github.com/sebastian-software/prepublish-lib) so that these work in the different destination environments. The [rollup-plugin](https://github.com/sebastian-software/prepublish-lib/blob/master/src/loader.js) is currently integrated in the tool, but I would definitely extract it into a separate solution/npm package once I feel that there is a solution. What I basically need to make the remaining issues fixed is that I can write out \"import\" statements which are not further processed by rollup.\r\n\r\nMy original approach was to just implement the `load(id)` method. There I am actually taking care of copying the source files to the destination folder and returning a valid ES modules import to the new CSS file. Unfortunately this does not work yet as rollup tries to then find the copied CSS file relative to the original file which does not work. What I miss is a possibility to write out an 'import' statement which is ignored by rollup in the later processing. Something which is comparable to the exclusion of `node_modules` when the required plugins are not available."},"comment":{"url":"https://api.github.com/repos/rollup/rollup/issues/comments/240360752","html_url":"https://github.com/rollup/rollup/issues/861#issuecomment-240360752","issue_url":"https://api.github.com/repos/rollup/rollup/issues/861","id":240360752,"user":{"login":"swernerx","id":145201,"avatar_url":"https://avatars.githubusercontent.com/u/145201?v=3","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":"2016-08-17T09:27:55Z","updated_at":"2016-08-17T09:27:55Z","body":"I made some progress. Actually I figure I have to implement `resolveId` for filtering the \"new\" copied over files. The documentation mentions that returning falsy values will mark them as external. In my experiments this does not seem to work.\r\n\r\nOutput:\r\n\r\n```\r\nProcessing style: /Users/Sebastian/Workspace/sebastian-software/prepublish-lib/test/index.css\r\nProcessed: /Users/Sebastian/Workspace/sebastian-software/prepublish-lib/test/index.css => lib/index-6abc46bc.css\r\nRR: Testing: ./index-6abc46bc.css\r\nRR: Marking external!\r\nError: Could not resolve './index-6abc46bc.css' from /Users/Sebastian/Workspace/sebastian-software/prepublish-lib/test/index.css\r\n    at /Users/Sebastian/Workspace/sebastian-software/prepublish-lib/node_modules/rollup/dist/rollup.js:7416:40\r\n```\r\n\r\nRelevant Code Block:\r\n\r\n```js\r\n    resolveId: function(importee, importer) {\r\n      console.log(\"RR: Testing:\", importee)\r\n      if (importee in externalIds) {\r\n        console.log(\"RR: Marking external!\")\r\n\r\n        // This does not seem to work!\r\n\r\n        // \"returning any other falsy value signals that importee should be treated as an external module\r\n        // and not included in the bundle.\" -- https://github.com/rollup/rollup/wiki/Plugins#creating-plugins\r\n        return false\r\n      }\r\n\r\n      console.log(\"RR: Delegating...\")\r\n    },\r\n```\r\n\r\n`externalIds` is a map which registers all the dynamically copied files. The lookup there seems to work when looking at the output."}}
{"actor":{"display_login":"swernerx"}}