{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/1255","labels_url":"https://api.github.com/repos/webpack/webpack/issues/1255/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/1255/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/1255/events","html_url":"https://github.com/webpack/webpack/issues/1255","id":95447597,"number":1255,"title":"Access the module name on Loader function","user":{"login":"lucasmotta","id":76673,"avatar_url":"https://avatars.githubusercontent.com/u/76673?v=3","gravatar_id":"","url":"https://api.github.com/users/lucasmotta","html_url":"https://github.com/lucasmotta","followers_url":"https://api.github.com/users/lucasmotta/followers","following_url":"https://api.github.com/users/lucasmotta/following{/other_user}","gists_url":"https://api.github.com/users/lucasmotta/gists{/gist_id}","starred_url":"https://api.github.com/users/lucasmotta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucasmotta/subscriptions","organizations_url":"https://api.github.com/users/lucasmotta/orgs","repos_url":"https://api.github.com/users/lucasmotta/repos","events_url":"https://api.github.com/users/lucasmotta/events{/privacy}","received_events_url":"https://api.github.com/users/lucasmotta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-16T14:36:38Z","updated_at":"2015-07-16T14:58:03Z","closed_at":null,"body":"I've been playing around with Webpack recently and I wanted to access the name of the module that is being loaded. So I could do something like this:\r\n\r\n```js\r\nmodule.exports = function(source) {\r\n  return source.replace(/(console.)(log|info|debug|warn)\\(/g, '$1$2(' + MODULE_NAME + ', ');\r\n}\r\n```\r\n\r\nThis would replace all the `console.log` messages to prefix the filename. I've noticed that the context (this) returns me a few parameters, but never the file name. Is it possible to do something like this at all?"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/121981160","html_url":"https://github.com/webpack/webpack/issues/1255#issuecomment-121981160","issue_url":"https://api.github.com/repos/webpack/webpack/issues/1255","id":121981160,"user":{"login":"lucasmotta","id":76673,"avatar_url":"https://avatars.githubusercontent.com/u/76673?v=3","gravatar_id":"","url":"https://api.github.com/users/lucasmotta","html_url":"https://github.com/lucasmotta","followers_url":"https://api.github.com/users/lucasmotta/followers","following_url":"https://api.github.com/users/lucasmotta/following{/other_user}","gists_url":"https://api.github.com/users/lucasmotta/gists{/gist_id}","starred_url":"https://api.github.com/users/lucasmotta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucasmotta/subscriptions","organizations_url":"https://api.github.com/users/lucasmotta/orgs","repos_url":"https://api.github.com/users/lucasmotta/repos","events_url":"https://api.github.com/users/lucasmotta/events{/privacy}","received_events_url":"https://api.github.com/users/lucasmotta/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T14:58:03Z","updated_at":"2015-07-16T14:58:03Z","body":"@IngwiePhoenix oh definitely, that was just a simple silly example.\r\n\r\nThe `this.resourcePath` is always empty for me - it's worth mentioning that I'm not using the loader with the require hook, I'm setting on my webpack.config:\r\n\r\n```\r\nloaders: [{ test: /\\.jsx?$/, loader: 'console', exclude: /(node_modules)/ }]\r\n```"}}