与代码智能感知不与webpack捆绑使用
我有一个简单的webpackconfiguration。
const path = require('path'); module.exports = { devtool: 'source-map', entry: './src/index.js', output: { libraryTarget: 'commonjs', filename: 'index.js', path: path.resolve(__dirname, 'dist'), }, };
在构build并将模块上传到npm并在其他项目上使用它们之后, vs代码 IntelliSense不适用于这些模块。 jsdoclogging了模块function。
import { myFunc } from 'myModule';
要么
const myModule = require('myModule');
Myfunc和myModule没有IntelliSense自动压缩支持或任何其他。
如何保持webpack构build后的jsdoc工作?
如果包通过npm传入,则需要发布types定义文件( .d.ts
)。 d.ts
文件包含您的API的types定义和注释,使我们能够有效地为外部软件包提供丰富的智能感知。 VS代码不会尝试从node_modules
包加载或parsing实际的JS代码。
以下是关于d.ts
文件入门的一些资源:
- VSCode的JS intellisense的工作原理: https ://code.visualstudio.com/Docs/languages/javascript#_intellisense
- 编写和发布d.ts文件: https ://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html
- JS / Lodash / Nodejs:在lodash foreach循环中,正在迭代的variables的打印名称
- 将在node.js中的原始套接字的支持,例如创buildping数据包?
- express.js多file uploadcallback
- 铁路由器使用Meteor.call抛出的动作writeHead不是一个函数
- node.js + socket.io + redis + rails – 实时应用程序
- javascript检查子节点是元素还是文本节点
- 这个代码可能会导致Node.js中的竞争状态吗?
- 如何将外部JSON数据从前一个任务中生成的文件传递给任务?
- 使用promise从mongo db中检索对象时出错