__webpack_public_path__ does not work in webpack 2

I’m submitting a bug report

Webpack version:
2.1.0-beta.25

Please tell us about your environment:
OSX 10.x

Current behavior:
set __webpack_public_path__ doesn’t work

Expected/desired behavior:
I set __webpack_public_path__ = ‘assets’ in entry.js,then use System.import('xxxx'), the require path doesn’t contain ‘assets

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [ES6/7]

Author: Fantashit

1 thought on “__webpack_public_path__ does not work in webpack 2

  1. Per https://webpack.js.org/guides/public-path/#set-value-on-the-fly:

    Another possible use case is to set the public path on the fly. webpack exposes a global variable that let’s you do that, it’s called webpack_public_path.

    However if APIPlugin does what I think it does, any usage of __webpack_public_path__ gets replaced by __webpack_require__.p. Which is fixed to the build-time publicPath value.

    This then breaks file-loader which correctly attempts to use __webpack_public_path__.

Comments are closed.