소스 검색

Updates #2350 Avoid bundling Strophe twice

by not importing Strophe outside of @converse/headless
JC Brand 4 년 전
부모
커밋
c855d2f4ce
6개의 변경된 파일5개의 추가작업 그리고 10개의 파일을 삭제
  1. 0 1
      src/headless/core.js
  2. 1 1
      src/headless/shared/connection.js
  3. 1 3
      src/headless/utils/core.js
  4. 1 3
      src/headless/utils/stanza.js
  5. 1 1
      src/modals/add-muc.js
  6. 1 1
      src/modals/muc-list.js

+ 0 - 1
src/headless/core.js

@@ -4,7 +4,6 @@
  * @license Mozilla Public License (MPLv2)
  */
 import './polyfill';
-import 'strophe.js/src/websocket';
 import Storage from '@converse/skeletor/src/storage.js';
 import advancedFormat from 'dayjs/plugin/advancedFormat';
 import dayjs from 'dayjs';

+ 1 - 1
src/headless/shared/connection.js

@@ -1,7 +1,7 @@
 import log from "../log.js";
 import sizzle from 'sizzle';
 import u from '@converse/headless/utils/core';
-import { Strophe } from 'strophe.js/src/core';
+import { Strophe } from 'strophe.js/src/strophe';
 import { _converse, api, clearSession, tearDown } from "../core.js";
 import { debounce, isElement } from 'lodash';
 

+ 1 - 3
src/headless/utils/core.js

@@ -3,14 +3,12 @@
  * @license Mozilla Public License (MPLv2)
  * @description This is the core utilities module.
  */
-import * as strophe from 'strophe.js/src/core';
+import { Strophe } from 'strophe.js/src/strophe';
 import { Model } from '@converse/skeletor/src/model.js';
 import { compact, last, isElement, isObject } from "lodash-es";
 import log from "@converse/headless/log";
 import sizzle from "sizzle";
 
-const Strophe = strophe.default.Strophe;
-
 /**
  * The utils object
  * @namespace u

+ 1 - 3
src/headless/utils/stanza.js

@@ -1,12 +1,10 @@
-import * as strophe from 'strophe.js/src/core';
+import { Strophe, $msg } from 'strophe.js/src/strophe';
 import dayjs from 'dayjs';
 import sizzle from 'sizzle';
 import u from '@converse/headless/utils/core';
 import log from "../log";
 import { _converse, api } from "@converse/headless/core";
 
-const Strophe = strophe.default.Strophe;
-const $msg = strophe.default.$msg;
 const { NS } = Strophe;
 
 

+ 1 - 1
src/modals/add-muc.js

@@ -1,10 +1,10 @@
 import tpl_add_muc from "./templates/add-muc.js";
 import BootstrapModal from "./base.js";
-import { Strophe } from 'strophe.js/src/strophe';
 import { __ } from '../i18n';
 import { _converse, api, converse } from "@converse/headless/core";
 
 const u = converse.env.utils;
+const { Strophe } = converse.env;
 
 
 export default BootstrapModal.extend({

+ 1 - 1
src/modals/muc-list.js

@@ -5,11 +5,11 @@ import st from "@converse/headless/utils/stanza";
 import tpl_list_chatrooms_modal from "./templates/muc-list.js";
 import tpl_room_description from "templates/room_description.html";
 import tpl_spinner from "templates/spinner.js";
-import { Strophe, $iq } from 'strophe.js/src/strophe';
 import { __ } from '../i18n';
 import { _converse, api, converse } from "@converse/headless/core";
 import { head } from "lodash-es";
 
+const { Strophe, $iq } = converse.env;
 const u = converse.env.utils;