sdkMultiplexerLoader.js 895 B

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