ソースを参照

fix: Load `moment` and bind to window from new file

- Introduce new file in `/lib` to import moment and bind to window
- Use new lib file to load moment in web bundle and libs bundle (desk)

Co-authored-by: Suraj Shetty <surajshetty3416@gmail.com>
version-14
marination 3年前
コミット
3f6eb5d99d
4個のファイルの変更7行の追加6行の削除
  1. +1
    -0
      frappe/public/js/frappe-web.bundle.js
  2. +0
    -2
      frappe/public/js/frappe/utils/datetime.js
  3. +5
    -0
      frappe/public/js/lib/moment.js
  4. +1
    -4
      frappe/public/js/libs.bundle.js

+ 1
- 0
frappe/public/js/frappe-web.bundle.js ファイルの表示

@@ -2,6 +2,7 @@ import "./jquery-bootstrap";
import "./frappe/class.js";
import "./frappe/polyfill.js";
import "./lib/md5.min.js";
import "./lib/moment.js";
import "./frappe/provide.js";
import "./frappe/format.js";
import "./frappe/utils/number_format.js";


+ 0
- 2
frappe/public/js/frappe/utils/datetime.js ファイルの表示

@@ -1,8 +1,6 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt

import moment from "moment/min/moment-with-locales.js";

frappe.provide('frappe.datetime');

frappe.defaultDateFormat = "YYYY-MM-DD";


+ 5
- 0
frappe/public/js/lib/moment.js ファイルの表示

@@ -0,0 +1,5 @@
// This file is used to make sure that `moment` is bound to the window
// before the bundle finishes loading, due to imports (datetime.js) in the bundle
// that depend on `moment`.
import momentTimezone from "moment-timezone/builds/moment-timezone-with-data.js";
window.moment = momentTimezone;

+ 1
- 4
frappe/public/js/libs.bundle.js ファイルの表示

@@ -1,15 +1,12 @@
import "./jquery-bootstrap";
import Vue from "vue/dist/vue.esm.js";
import moment from "moment/min/moment-with-locales.js";
import momentTimezone from "moment-timezone/builds/moment-timezone-with-data.js";
import "./lib/moment";
import io from "socket.io-client/dist/socket.io.slim.js";
import Sortable from "./lib/Sortable.min.js";
// TODO: esbuild
// Don't think jquery.hotkeys is being used anywhere. Will remove this after being sure.
// import "./lib/jquery/jquery.hotkeys.js";

window.moment = moment;
window.moment = momentTimezone;
window.Vue = Vue;
window.Sortable = Sortable;
window.io = io;

読み込み中…
キャンセル
保存