setPublicPath.js 784 B

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