setPublicPath.js 756 B

12345678910111213141516171819202122
  1. // This file is imported into lib/wc client bundles.
  2. if (typeof window !== 'undefined') {
  3. var currentScript = window.document.currentScript
  4. if (process.env.NEED_CURRENTSCRIPT_POLYFILL) {
  5. var getCurrentScript = require('@soda/get-current-script')
  6. currentScript = getCurrentScript()
  7. // for backward compatibility, because previously we directly included the polyfill
  8. if (!('currentScript' in document)) {
  9. Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
  10. }
  11. }
  12. var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
  13. if (src) {
  14. __webpack_public_path__ = src[1] // eslint-disable-line
  15. }
  16. }
  17. // Indicate to webpack that this file can be concatenated
  18. export default null