sdkMultiplexerLoader.js 955 B

1234567891011121314151617181920212223
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. /**
  3. * This loader allows us to multiplex SDKs depending on what is passed to the `importTarget` loader option.
  4. * If this loader encounters a file that contains the string "__SENTRY_SDK_MULTIPLEXER__" it will replace it's entire
  5. * content with an "export all"-statement that points to `importTarget`.
  6. *
  7. * In our case we use this to multiplex different SDKs depending on whether we're bundling browser code, server code,
  8. * or edge-runtime code.
  9. */
  10. function sdkMultiplexerLoader( userCode) {
  11. if (!userCode.includes('_SENTRY_SDK_MULTIPLEXER')) {
  12. return userCode;
  13. }
  14. // We know one or the other will be defined, depending on the version of webpack being used
  15. const { importTarget } = 'getOptions' in this ? this.getOptions() : this.query;
  16. return `export * from "${importTarget}";`;
  17. }
  18. exports.default = sdkMultiplexerLoader;
  19. //# sourceMappingURL=sdkMultiplexerLoader.js.map