在keystonejs上添加来自nodemodule的库

问题描述 投票:0回答:1

我想知道将节点模块中的库链接到默认模板的解决方案是什么。

enter image description here

keystonejs
1个回答
1
投票

有两种方法可以做到:

  1. 创建一个脚本,将所需文件从node_modules / mathjax文件夹复制到public/js文件夹,并在脚本标记中使用/js/mathjax/mathjax.js
  2. 在node_module app.use('/js/mathjax', express.static(path.dirname(require.resolve('mathjax'));中专门为lib创建路由
© www.soinside.com 2019 - 2024. All rights reserved.