I have a simple webpack config .
const path = require('path');
module.exports = {
devtool: 'source-map',
entry: './src/index.js',
output: {
libraryTarget: 'commonjs',
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
},
};
After I build and upload my modules to npm and use them on other projects the vs code IntelliSense is not working for these modules. The module functions are documented with jsdoc.
import { myFunc } from 'myModule';
Or
const myModule = require('myModule');
Myfunc and myModule have no IntelliSense auto complate support or any other.
How can I keep the jsdoc working after webpack build?
If the package is coming through npm, you need to publish a type definition file (.d.ts
). d.ts
files contain type definitions and comments for your API that allow us to efficiently provide rich intellisense for external packages. VS Code is limited in how it can parse the actual JS code from node_modules
packages.
Here's some resources on getting started with d.ts
files:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With