Search code examples
webpackwebpack-2

How to access the webpack config with the new Loader API?


My loader (external-svg-sprite-loader) requires access to the option output.publicPath defined in the webpack configuration file. According to webpack 2 documentation the this.options property in the Loader API was deprecated, which means at some point my loader will no longer work. Is there another way of accessing this value or of generating a URL based on the value of output.publicPath?


Solution

  • The solution was to use the compile time variable __webpack_public_path__.