Skip to content

Commit

Permalink
fix: import lodash as mjs to reduce bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
eatgrass committed Jan 3, 2024
1 parent e2e4d30 commit 0f9da79
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/renderers/lrc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { chunk } from 'lodash'
import { MarkdownRenderer, type App, type Component } from 'obsidian'
import {
DEFAULT_LRC,
Expand All @@ -16,7 +15,7 @@ export default class LrcRenderer extends AbstractLyricsRenderer {
public match(content: string): number {
const s = content.split(LrcRenderer.LRC_SPLITTER)
s.shift()
return chunk(s, 7).length
return this.chunk(s, 7).length
}

public async render(
Expand All @@ -39,7 +38,7 @@ export default class LrcRenderer extends AbstractLyricsRenderer {
component,
)
}
let lines = chunk(s, 7)
let lines = this.chunk(s, 7)

let mdEl: HTMLSpanElement[] = await Promise.all(
lines.map(async (parts, index) => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/renderer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MarkdownRenderer, type App, type Component } from 'obsidian'
import { chunk } from 'lodash'
import chunk from 'lodash/chunk'

export type LyricsLine = {
timestamp?: number // milliseconds
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"target": "ES6",
"esModuleInterop": false,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"moduleResolution": "node",
"importHelpers": true,
Expand Down

0 comments on commit 0f9da79

Please sign in to comment.