我正在尝试将节点应用程序捆绑到单个文件中。
然而,在检查打包后 webpack 的输出后。
我发现其中一个库用于Module.createRequire在运行时加载某些模块。检查捆绑的代码,我了解到 webpack 不会替换Module.createRequire(path).resolve为__webpack_require__,这导致我的应用程序在捆绑后依赖于 node_module 。
我可以想到一个简单的解决方案,通过修改库的代码并使用require而不是Module.createRequire. 但我不想修改库代码,因为每次我想更新库时都会增加额外的头痛。
Module.createRequire(myPath)其次,我想知道我是否根据Webpack Context替换以下代码,require(myPath)webpack会捆绑所有 node_modules,因为结果表达式将与所有模块匹配?*
在 Google 表格中,我有一个由 backendcode.gs和 frontend两部分组成的附加组件index.html,其中 index.html 是单击菜单时显示的侧边栏。这是code.gs:
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('My add-on')
.addItem('Test', 'openSideBar')
.addToUi();
}
function onSelectionChange(e) {
Logger.log("Selection changed ");
}
function openSideBar() {
var html = HtmlService.createHtmlOutputFromFile('Index');
SpreadsheetApp.getUi().showSidebar(html);
}
function getCurrentSelection() {
var currentCell = SpreadsheetApp.getCurrentCell();
return { column: currentCell.getColumn(), row: currentCell.getRow() };
}
Run Code Online (Sandbox Code Playgroud)
这是onSelectionChange的文档。在Logger.log("Selection changed")当选择的是变化的确叫。但是,当用户单击单元格并更改选择时,我需要在前端通知或进行更改。
这是index.html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
Test
<input type="text" id="formula" />
<script>
function onSelectionChangeJs(e) { …Run Code Online (Sandbox Code Playgroud) 假设我有两张桌子,首先是:
Course table
----------------
|id | name |
|0 | pr course|
|1 | science |
----------------
Run Code Online (Sandbox Code Playgroud)
另一个是:
Teacher table
----------------------
|id | name | Courses |
|0 | mark | 0 ,1 |
|1 | john | 0 |
----------------------
Run Code Online (Sandbox Code Playgroud)
我想在课程栏中输入教师在连接语句中使用它们的课程的ID.做这样的事情的最佳方法是什么.我希望我很清楚,谢谢你.