From 61cb4f5c3ae57e7e2bcd49264844c9d9157b85f4 Mon Sep 17 00:00:00 2001 From: Joshua Lochner Date: Mon, 18 Dec 2023 20:23:40 +0200 Subject: [PATCH] Include `@huggingface/jinja` in exported webpack build (#458) In future, probably a better idea to dynamically import. However, currently it affects importing from CDNs. --- src/tokenizers.js | 2 +- webpack.config.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tokenizers.js b/src/tokenizers.js index 8ac89d25b..50f1bd490 100644 --- a/src/tokenizers.js +++ b/src/tokenizers.js @@ -2827,7 +2827,7 @@ export class PreTrainedTokenizer extends Callable { // (i.e., must be installed separately), an error is thrown if it is not installed. let Template; try { - Template = (await import('@huggingface/jinja')).Template; + Template = (await import( /* webpackMode: "eager" */ '@huggingface/jinja')).Template; } catch (e) { throw new Error( `apply_chat_template requires '@huggingface/jinja' to be installed. ` + diff --git a/webpack.config.js b/webpack.config.js index 6adcfd9d9..c958b45b8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,6 +5,9 @@ import path from 'path'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); +/** + * @type {import('webpack').Configuration} + */ export default { mode: 'development', devtool: 'source-map',