我正在使用 monaco-editor,我想包含来自多个文件的建议。我不确定什么是最好的方法,但基本上,我希望当我在 file2.js 中导出一些函数时,能够从建议中的另一个 file1.js 访问它。
关于如何实现这一目标的任何想法?谢谢 !
文件 1
var express = require('express');
var pug = require('pug');
var config = require('./config');
var fs = require('fs');
var router = express.Router();
var utils = require('/utils');
// Here I would like to use the function newTest from the other file
but it does not show in the suggestions
router.get('/', function (req, res) {
console.log("ip - ", req.connection.remoteAddress)
res.send(pug.compileFile('views/main.pug')({
config
}))
});
module.exports = router;
Run Code Online (Sandbox Code Playgroud)
文件 2
function newTest() {
}
module.exports.newTest = …Run Code Online (Sandbox Code Playgroud)