Skip to content

Commit 0910c25

Browse files
committed
Load markdown files through markdown-with-front-matter-loader
1 parent c9bc6ce commit 0910c25

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ module.exports = {
137137
/\.(js|jsx)$/,
138138
/\.css$/,
139139
/\.json$/,
140-
/\.svg$/
140+
/\.svg$/,
141+
/\.md$/
141142
],
142143
loader: 'url-loader',
143144
options: {
@@ -201,6 +202,12 @@ module.exports = {
201202
options: {
202203
name: 'static/media/[name].[hash:8].[ext]'
203204
}
205+
},
206+
// Load Markdown files by converting them to JSON. It's then up to
207+
// the consumer to render the result
208+
{
209+
test: /\.md$/,
210+
loader: 'markdown-with-front-matter-loader'
204211
}
205212
// ** STOP ** Are you adding a new loader?
206213
// Remember to add the new extension(s) to the "url" loader exclusion list.

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ module.exports = {
144144
/\.(js|jsx)$/,
145145
/\.css$/,
146146
/\.json$/,
147-
/\.svg$/
147+
/\.svg$/,
148+
/\.md$/
148149
],
149150
loader: 'url-loader',
150151
options: {
@@ -215,6 +216,12 @@ module.exports = {
215216
options: {
216217
name: 'static/media/[name].[hash:8].[ext]'
217218
}
219+
},
220+
// Load Markdown files by converting them to JSON. It's then up to
221+
// the consumer to render the result
222+
{
223+
test: /\.md$/,
224+
loader: 'markdown-with-front-matter-loader'
218225
}
219226
// ** STOP ** Are you adding a new loader?
220227
// Remember to add the new extension(s) to the "url" loader exclusion list.

packages/react-scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"html-webpack-plugin": "2.28.0",
5353
"http-proxy-middleware": "0.17.3",
5454
"jest": "18.1.0",
55+
"markdown-with-front-matter-loader": "^0.1.0",
5556
"object-assign": "4.1.1",
5657
"postcss-loader": "1.2.2",
5758
"promise": "7.1.1",

0 commit comments

Comments
 (0)