diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index e26a5a25d81..a0a5d8fe919 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -137,7 +137,8 @@ module.exports = { /\.(js|jsx)$/, /\.css$/, /\.json$/, - /\.svg$/ + /\.svg$/, + /\.md$/ ], loader: 'url-loader', options: { @@ -201,6 +202,12 @@ module.exports = { options: { name: 'static/media/[name].[hash:8].[ext]' } + }, + // Load Markdown files by converting them to JSON. It's then up to + // the consumer to render the result + { + test: /\.md$/, + loader: 'markdown-with-front-matter-loader' } // ** STOP ** Are you adding a new loader? // Remember to add the new extension(s) to the "url" loader exclusion list. diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 86d87d39211..ae5cee95d3b 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -144,7 +144,8 @@ module.exports = { /\.(js|jsx)$/, /\.css$/, /\.json$/, - /\.svg$/ + /\.svg$/, + /\.md$/ ], loader: 'url-loader', options: { @@ -215,6 +216,12 @@ module.exports = { options: { name: 'static/media/[name].[hash:8].[ext]' } + }, + // Load Markdown files by converting them to JSON. It's then up to + // the consumer to render the result + { + test: /\.md$/, + loader: 'markdown-with-front-matter-loader' } // ** STOP ** Are you adding a new loader? // Remember to add the new extension(s) to the "url" loader exclusion list. diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 371b952c8c5..7eb09e852af 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -52,6 +52,7 @@ "html-webpack-plugin": "2.28.0", "http-proxy-middleware": "0.17.3", "jest": "18.1.0", + "markdown-with-front-matter-loader": "^0.1.0", "object-assign": "4.1.1", "postcss-loader": "1.2.2", "promise": "7.1.1",