Skip to content

v2: Allow custom extensions to be passed into the Webpack file loader #4445

@mattisdada

Description

@mattisdada

🚀 Feature

The ability to provide your own list of file extensions to be loaded via file loader or a specific directory that will always be loaded in via the file loader.

Have you read the Contributing Guidelines on issues?

Yes

Motivation

I currently have a YAML file that needs to be downloaded via the static file server, currently the only way to get download paths are by import or require, but the file loader is limited to pdf|doc|docx|xls|xlsx|zip|rar (reference) currently with no way of adding to that list. This will cause the Webpack loader to panic with a You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. error.

Handling files that are not in this very limited list are impossible to use with Docusaurus for generating download links, this limits the functionality greatly.

Example

import InsomniaUrl from "@site/static/downloads/insomnia.yml";
// You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.

Pitch

There should be a configuration option in docusaurus.config.js to allow setting a custom list (or appending to the existing list) of allowed file types to be used by the file loader. Alternatively a path (ie static/downloads) where all files get handled by the file loader, this path should be configurable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed: wontfixA fix will bring significant overhead, or is out of scope (for feature requests)featureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions