Import the test from './test. The md ';
ComponentDidMount=()=& gt; {
Fetch (test)//is at fault here
Then (res=& gt; Res. The text ())
Then (text=& gt; {
.
});
}
Is because I want to get to the content of the markdown files, and then parse, so I only found on the Internet such a method can obtain the file content, and read into string format, the great god have what way can read text content as a string, or me how to use the fetch that can once run build after normal use
CodePudding user response:
The fetch MDN link: https://developer.mozilla.org/zh-CN/docs/Web/API/Fetch_APICodePudding user response:
Bosses, I see you send the link, but did not solve my problemCodePudding user response:
You try to import the test from './test. The md '; The sentence below. Add a console log (test), and then enter the page to see the console,,,CodePudding user response:
I doubt that is the time to build, webpack judgment test has not been used, so this resource has not been packaged to come in, but why is there the fetch (test); A reference is thus not clear; Could you as the upstairs said, write a sentence: the console. The log (test); , keep the reference to the test, let webpack identification to the test resources are in use