Sphinx-js 找不到类文档

问题描述 投票:0回答:1

我正在尝试设置 sphinx_js 但我一直收到此错误:

~/test_sphinx_js$ sphinx-build  -b html docs/source/ docs/build/html/
Running Sphinx v4.4.0
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                                                    
Sphinx error:
No documentation was found for object "SomeClass" or any path ending with that.

这是我的测试项目结构:

.
├── docs
│   ├── build
│   │   └── html
│   ├── make.bat
│   ├── Makefile
│   └── source
│       ├── conf.py
│       ├── index.rst
│       ├── _static
│       └── _templates
└── src
    └── SomeClass.js

这些是相关的设置和代码:

conf.py

[...]
extensions = ['sphinx_js']
js_source_path = '../../src'
primary_domain = 'js'
[...]

index.rst:

Welcome to SomeDocs's documentation!
====================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. js:autoclass:: SomeClass

SomeClass.js:

/** Class representing something. */
export default class SomeClass {

    /**
     * Create class.
     * @param {string} name - The name of the object.
     * @param {string} type - The type of object.
     */
    constructor(name, type) {
        this.name = name;
        this.type = type;

    }
}

我一定是遗漏了一些明显的东西,但我无法理解它

javascript python-sphinx
1个回答
0
投票

js:autoclass 不知道如何解析 'export default class...'。您可以声明您的类而无需预先添加“export default”,并且在类声明之后单独的一行可以声明“export default SomeClass”,如果您确实需要导出类。

© www.soinside.com 2019 - 2024. All rights reserved.