Module not found: Can't resolve '#minpath' during compilation

Open
#183 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript

Research direction

Reproduce the CRA-based TypeScript setup with @uiw/react-textarea-code-editor and inspect the dependency path leading to vfile/lib and the unresolved #minpath import. Compare the installed package versions and build configuration, then verify that npm start compiles the example without the module-resolution error.

Written by the indexing model from the issue text.

Description

I'm using @uiw/react-textarea-code-editor in a React project to create a basic HTML code editor. The editor works fine in the component logic, but upon compiling the app, I receive the following error:

Image

📁 Environment

Project type: React (TypeScript)
Code Editor: @uiw/react-textarea-code-editor
Build tool: React Scripts (CRA-based)
OS: Windows 11
Node: v20.18.0
NPM: v10.8.2

🧪 Steps to Reproduce

Install @uiw/react-textarea-code-editor

Use it in a component like this:

<CodeEditor
  value={code}
  language="html"
  placeholder="Please enter HTML code"
  onChange={(evn) => setCode(evn.target.value)}
/>

Run npm start

Compilation fails cannot resolve #minpath error from vfile\lib

✅ What I've Tried
npm update vfile
npm install #minpath
Code Snippet
import React, { useEffect, useState } from "react";
import CodeEditor from '@uiw/react-textarea-code-editor';

interface IHtmlCodeEditorProps {
    htmlValue: string;
    setHtmlValue: (value: string) => void;
    readOnly?: boolean;
    show?: boolean;
}

export const HtmlCodeEditor = (props: IHtmlCodeEditorProps) => {
    const [code, setCode] = useState(props.htmlValue);

    const handleCodeChange = (newCode: string) => {
        setCode(newCode);
        props.setHtmlValue(newCode);
    };

    return (
        <div style={{ display: 'flex', flexDirection: 'column', gap: '10px', width: '100%' }}>
            {props.show && (
                <>

                    <CodeEditor
                        value={code}
                        language="html"
                        placeholder="Please enter HTML code."
                        onChange={(evn) => handleCodeChange(evn.target.value)}
                        padding={15}
                        style={{
                            backgroundColor: "#f5f5f5",
                            fontFamily: 'ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace',
                        }}
                    />
                    <pre style={{ overflowY: "auto", whiteSpace: 'pre-wrap', wordWrap: 'break-word', overflow: 'auto' }}>
                        {code}
                    </pre>

                </>
            )}
        </div>
    );
};
Dominant language
TypeScript
Stars
575
Forks
23
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uiwjs/react-textarea-code-editor

All issues in uiwjs/react-textarea-code-editor

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.