jamesandersen / string-replace-webpack-plugin

Replace string tokens in a bundle.
93 stars 27 forks source link

Is it possible to get the file path #12

Open pavel06081991 opened 8 years ago

pavel06081991 commented 8 years ago

Hi. Is it possible to get the path of file which is processed by loader?

georgespyropoulos commented 8 years ago

I had the same question and have just figured it out for myself.

Within the replacement function you can access the following properties of 'this': https://webpack.github.io/docs/loaders.html#loader-context

replacement: function (match, p1, offset, string) {
   console.log(this.resource)
}