Browse Source

Fix moment and markdown emoji modules

feature/settings-cleanup
GreatBearShark 1 year ago
parent
commit
f19b6cd0a2
  1. 3
      package.json
  2. 64
      src/utils.ts
  3. 34
      vite.config.ts

3
package.json

@ -11,8 +11,7 @@
"lint": "tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src",
"prebuild": "node generate_translations.js",
"prestart": "node generate_translations.js",
"start": "node generate_translations.js && EXTEND_ESLINT=true TSC_COMPILE_ON_ERROR=true PORT=4444 react-scripts start",
"dev": "vite --port 4444",
"start": "node generate_translations.js && vite --port 4444",
"start_old": "node fuse dev"
},
"keywords": [],

64
src/utils.ts

@ -1,30 +1,31 @@
// import 'moment/locale/es';
// import 'moment/locale/el';
// import 'moment/locale/eu';
// import 'moment/locale/eo';
// import 'moment/locale/de';
// import 'moment/locale/zh-cn';
// import 'moment/locale/fr';
// import 'moment/locale/sv';
// import 'moment/locale/ru';
// import 'moment/locale/nl';
// import 'moment/locale/it';
// import 'moment/locale/fi';
// import 'moment/locale/ca';
// import 'moment/locale/fa';
// import 'moment/locale/pl';
// import 'moment/locale/pt-br';
// import 'moment/locale/ja';
// import 'moment/locale/ka';
// import 'moment/locale/hi';
// import 'moment/locale/gl';
// import 'moment/locale/tr';
// import 'moment/locale/hu';
// import 'moment/locale/uk';
// import 'moment/locale/sq';
// import 'moment/locale/km';
// import 'moment/locale/ga';
// import 'moment/locale/sr';
// @TODO: Figure out how to do this properly with esmodules
import 'moment/locale/es';
import 'moment/locale/el';
import 'moment/locale/eu';
import 'moment/locale/eo';
import 'moment/locale/de';
import 'moment/locale/zh-cn';
import 'moment/locale/fr';
import 'moment/locale/sv';
import 'moment/locale/ru';
import 'moment/locale/nl';
import 'moment/locale/it';
import 'moment/locale/fi';
import 'moment/locale/ca';
import 'moment/locale/fa';
import 'moment/locale/pl';
import 'moment/locale/pt-br';
import 'moment/locale/ja';
import 'moment/locale/ka';
import 'moment/locale/hi';
import 'moment/locale/gl';
import 'moment/locale/tr';
import 'moment/locale/hu';
import 'moment/locale/uk';
import 'moment/locale/sq';
import 'moment/locale/km';
import 'moment/locale/ga';
import 'moment/locale/sr';
import {
UserOperation,
@ -51,7 +52,7 @@ import { UserService, WebSocketService } from './services';
import Tribute from 'tributejs/src/Tribute.js';
import markdown_it from 'markdown-it';
// import * as markdownitEmoji from 'markdown-it-emoji/light';
import markdownitEmoji from "markdown-it-emoji/light";
import markdown_it_container from 'markdown-it-container';
import iterator from 'markdown-it-for-inline';
import emojiShortName from 'emoji-short-name';
@ -59,7 +60,6 @@ import Toastify from 'toastify-js';
import tippy from 'tippy.js';
import EmojiButton from '@joeattardi/emoji-button';
import { customEmojis, replaceEmojis } from './custom-emojis';
import { match } from 'assert';
import moment from 'moment';
export const repoUrl = 'https://gitlab.com/chapo-sandbox/production';
@ -180,9 +180,9 @@ export const md = new markdown_it({
}
},
})
// .use(markdownitEmoji, {
// defs: objectFlip(emojiShortName),
// })
.use(markdownitEmoji, {
defs: objectFlip(emojiShortName),
})
.use(iterator, 'url_new_win', 'link_open', function (tokens, idx) {
// make sure all inline links open in a new window and don't include the referrer
tokens[idx].attrPush(['target', '_blank']);

34
vite.config.ts

@ -5,7 +5,39 @@ const config: UserConfig = {
jsx: 'react',
plugins: [reactPlugin],
optimizeDeps: {
include: ['markdown-it-container', 'moment']
include: [
'markdown-it-container',
'moment',
'markdown-it-emoji',
"markdown-it-emoji/light",
"moment/locale/es",
"moment/locale/el",
"moment/locale/eu",
"moment/locale/eo",
"moment/locale/de",
"moment/locale/zh-cn",
"moment/locale/fr",
"moment/locale/sv",
"moment/locale/ru",
"moment/locale/nl",
"moment/locale/it",
"moment/locale/fi",
"moment/locale/ca",
"moment/locale/fa",
"moment/locale/pl",
"moment/locale/pt-br",
"moment/locale/ja",
"moment/locale/ka",
"moment/locale/hi",
"moment/locale/gl",
"moment/locale/tr",
"moment/locale/hu",
"moment/locale/uk",
"moment/locale/sq",
"moment/locale/km",
"moment/locale/ga",
"moment/locale/sr",
]
}
}

Loading…
Cancel
Save