I built a Javascript Library that has jsdoc typings for functions but they don't appear on hover in VS code when I consume that library. Sample jsdoc'ed function
/**
* @param {Object} jsql - Valid query
* @param {number} [size=20] - Number of rows returned
* @param {number} [wait=60000] - Query wait time
* @returns {Object}
*/
executeJSQL({ size = 20, wait = 60000, jsql }) {
I checked that these definitions don't appear in my webpack build dist/index.js but, they are included in dist/index.js.map. Maybe I am missing something in my webpack config.
Here's my webpack config.js
/* eslint-disable no-nested-ternary */
const path = require('path');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const zopfli = require('@gfx/zopfli');
const CompressionPlugin = require('compression-webpack-plugin');
var JsDocPlugin = require('jsdoc-webpack-plugin');
const NUM_ITERATIONS = 15;
const ASSET_BASE_SIZE = 1024;
const MAX_ASSET_SIZE = 700 * ASSET_BASE_SIZE;
const MIN_ASSET_SIZE = 30 * ASSET_BASE_SIZE;
module.exports = (env = {}) => {
const config = {
watchOptions: {
ignored: ['/node_modules', '/dist', '/coverage', '/__mocks__'],
},
mode: env.NODE_ENV || 'production',
entry: './src/index.js',
output: {
library: 'XDBCBuilder',
filename: 'index.js',
libraryTarget: 'umd',
path:
env.DEV_STATUS === 'porting'
? path.resolve(
__dirname,
env.FROM_PATH,
'node_modules',
)
: env.NODE_ENV === 'production'
? path.resolve(__dirname, 'dist')
: path.resolve(
__dirname,
'node_modules',
'builder'
),
publicPath: '/builder/',
},
target: 'node',
devtool: env.NODE_ENV === 'production' ? 'source-map' : 'eval-source-map',
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-react'],
},
},
],
},
],
},
optimization: {
removeAvailableModules: true,
mangleWasmImports: false,
nodeEnv: env.NODE_ENV,
moduleIds: 'size',
splitChunks: {
chunks: 'async',
name: true,
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
},
default: {
priority: -20,
reuseExistingChunk: true,
},
},
},
},
watchOptions: {
ignored: [
path.resolve(__dirname, 'dist'),
path.resolve(__dirname, 'coverage'),
path.resolve(__dirname, '__mocks__'),
],
},
performance: {},
context: __dirname,
resolve: {
alias: {
src: path.join(__dirname, 'src'),
},
},
node: {
console: 'mock', // boolean | "mock"
global: true, // boolean | "mock"
process: true, // boolean
__filename: 'mock', // boolean | "mock"
__dirname: 'mock', // boolean | "mock"
Buffer: true, // boolean | "mock"
setImmediate: true, // boolean | "mock" | "empty"
},
plugins: [],
};
if (env.NODE_ENV === 'production') {
config.plugins.push(
new CompressionPlugin({
compressionOptions: {
numiterations: NUM_ITERATIONS,
},
algorithm(input, compressionOptions, callback) {
return zopfli.gzip(input, compressionOptions, callback);
},
exclude: [/node_modules/],
})
);
config.optimization.splitChunks.maxSize = MAX_ASSET_SIZE;
config.optimization.splitChunks.minSize = MIN_ASSET_SIZE;
config.performance.maxAssetSize = MAX_ASSET_SIZE;
config.performance.maxEntrypointSize = MAX_ASSET_SIZE;
}
if (env.NODE_ENV !== 'production') {
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: '../webpack-bundle-report.html',
openAnalyzer: false,
})
);
}
return config;
};