如何运行jsdoc wtih网页包?

u91tlkcl  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(228)

上周我开始配置webpack,出现了一个问题:如何使用webpack运行jsdoc生成?
所有jsdoc网页包似乎都已弃用或过时。。。
我的简单配置文件:

  1. const path = require('path');
  2. const HtmlWebpackPlugin = require("html-webpack-plugin");
  3. const ESLintPlugin = require('eslint-webpack-plugin');
  4. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  5. let config = {
  6. entry: {
  7. app: ['./src/js/css.js', './src/js/app.js']
  8. },
  9. output: {
  10. filename: 'assets/js/[name].[contenthash].bundle.js',
  11. path: path.resolve(__dirname, 'dist'),
  12. clean: true
  13. },
  14. devServer: {
  15. contentBase: path.join(__dirname, 'dist'),
  16. compress: true,
  17. port: 9000,
  18. },
  19. mode: 'development',
  20. // mode: 'production',
  21. devtool: 'inline-source-map',
  22. module: {
  23. rules: [
  24. // LOADER BABEL
  25. {
  26. test: /\.m?js$/,
  27. exclude: /(node_modules|bower_components)/,
  28. use: {
  29. loader: 'babel-loader',
  30. options: {
  31. presets: ['@babel/preset-env'],
  32. targets: ['defaults'],
  33. plugins: ['@babel/plugin-proposal-object-rest-spread']
  34. }
  35. }
  36. },
  37. // LOADER STYLE + CSS
  38. {
  39. test: /\.css$/i,
  40. use: ["style-loader", "css-loader"],
  41. },
  42. ]
  43. },
  44. plugins: [
  45. new HtmlWebpackPlugin({
  46. template: "./index.html"
  47. }),
  48. new ESLintPlugin({
  49. extensions: ["js", "jsx", "ts", "tsx"],
  50. })
  51. ]
  52. };
  53. let analyzerMode = process.argv.find(param => param === '--analyze');
  54. config.plugins.push(new BundleAnalyzerPlugin({
  55. openAnalyzer: false,
  56. defaultSizes: 'gzip',
  57. analyzerMode: analyzerMode ? 'static' : 'disabled'
  58. }));
  59. module.exports = config;

现在,在我的项目中,可以运行jsdoc src/js/,它将生成包含所有js文档的out文件夹。
如何使用webpack.config.js自动执行此过程命令?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题