Add markdown rule
See original GitHub issueHello, I’ve made a few attempts and want to know if I’m on the right track.
I’m importing project details in markdown files and I’ve set the webpack option within static.config.js as follows:
webpack: (config, { defaultLoaders }) => {
const renderer = new marked.Renderer()
config.module.rules.push({
test: /\.md$/,
loader: 'html!markdown?gfm=false',
options: renderer,
})
return config
},
When running the project I get a series of errors:
Failed to rebuild.
./node_modules/grid-styled/dist/index.js
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <p>'use strict';</p>
| <p>Object.defineProperty(exports, "__esModule", {
| value: true
./node_modules/react-dom/index.js
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <p>'use strict';</p>
| <p>function checkDCE() {
| /<em> global <strong>REACT_DEVTOOLS_GLOBAL_HOOK</strong> </em>/
./node_modules/react/index.js
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <p>'use strict';</p>
| <p>if (process.env.NODE_ENV === 'production') {
| module.exports = require('./cjs/react.production.min.js');
And the errors continue quite a bit. Obviously I’m not configuring webpack correctly. I assume that if it had anything to do with the html
loader definition in my new rules that it would fail at an HTML item and tell me so. Your docs seem high-quality, I just believe I’m missing something. Any direction would be greatly appreciated, thank you.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Basic Syntax - Markdown Guide
To create an ordered list, add line items with numbers followed by periods. The numbers don't have to be in numerical order, but...
Read more >Markdown Syntax Documentation - Daring Fireball
Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph: > This is a...
Read more >Markdown rules and formatting | Kong Docs
Add a tag to the front matter of each topic that you edit. Add the tag that most closely resembles the concept, even...
Read more >Markdown Basics — markdown-guide 0.1 documentation
You can create a horizontal rule ( <hr /> ) by placing 3 or more hyphens, asterisks, or underscores on a single line...
Read more >Basic writing and formatting syntax - GitHub Docs
To create a heading, add one to six # symbols before your heading text. ... shortcut to insert the backticks for a code...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@josephdburdick Ah, gotcha. You need to use webpack in the files that will eventually get sent to your users’ browser, but in the
static.config.js
file you can use any Node utility you like, e.g:I added an example to the same repository.
I appreciate the examples you guys have produced, it has helped me get a better idea as to what the problem is and what the solution could be.
First, I understand the approach with static.config.js, is there a way however to import the .md file inside the static.config.js file so produce the data that would be summoned within a route definition? For example, I have a route for “projects” and each :id for the project is the name of the markdown or frontmatter file that would be pulled from
src/projects/projectID.md