From 3dcb9cb494d3693e026f8003668dce4da77f294b Mon Sep 17 00:00:00 2001 From: Evgeny Biriulin Date: Mon, 20 Nov 2023 16:51:26 +0400 Subject: [PATCH] fix: use dynamic import of transform assets to avoid fs error --- src/generate/utils.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/generate/utils.ts b/src/generate/utils.ts index 6cfee65..3fc1a71 100644 --- a/src/generate/utils.ts +++ b/src/generate/utils.ts @@ -1,21 +1,21 @@ import {readFileSync} from 'fs'; import {join} from 'path'; -const yfmStylesPath = require.resolve('@diplodoc/transform/dist/css/yfm.css'); -const yfmStyles = readFileSync(yfmStylesPath, 'utf-8'); +import {SINGLE_PAGE_DATA_FILENAME} from './constants'; -const yfmPrintStylesPath = require.resolve('@diplodoc/transform/dist/css/print.css'); -const yfmPrintStyles = readFileSync(yfmPrintStylesPath, 'utf-8'); +export function generatePdfStaticMarkup(html: string) { + const yfmStylesPath = require.resolve('@diplodoc/transform/dist/css/yfm.css'); + const yfmStyles = readFileSync(yfmStylesPath, 'utf-8'); -const yfmPrintJSPath = require.resolve('@diplodoc/transform/dist/js/print.js'); -const yfmPrintJS = readFileSync(yfmPrintJSPath, 'utf-8'); + const yfmPrintStylesPath = require.resolve('@diplodoc/transform/dist/css/print.css'); + const yfmPrintStyles = readFileSync(yfmPrintStylesPath, 'utf-8'); -const yfmJSPath = require.resolve('@diplodoc/transform/dist/js/yfm.js'); -const yfmJS = readFileSync(yfmJSPath, 'utf-8'); + const yfmPrintJSPath = require.resolve('@diplodoc/transform/dist/js/print.js'); + const yfmPrintJS = readFileSync(yfmPrintJSPath, 'utf-8'); -import {SINGLE_PAGE_DATA_FILENAME} from './constants'; + const yfmJSPath = require.resolve('@diplodoc/transform/dist/js/yfm.js'); + const yfmJS = readFileSync(yfmJSPath, 'utf-8'); -export function generatePdfStaticMarkup(html: string) { return `