Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Load markdown files as raw string #29

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ module.exports = {
// directory for faster rebuilds.
cacheDirectory: true,
},
}
]
},
],
},
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
Expand All @@ -191,7 +191,9 @@ module.exports = {
loader: require.resolve('css-loader'),
options: {
importLoaders: 2,
modules: process.env.CSS_MODULES ? process.env.CSS_MODULES == 'true' : true,
modules: process.env.CSS_MODULES
? process.env.CSS_MODULES == 'true'
: true,
camelCase: true,
localIdentName: '[path][name]__[local]--[hash:base64:5]',
},
Expand Down Expand Up @@ -221,6 +223,11 @@ module.exports = {
},
],
},
// This loader will load markdown files as raw string.
{
test: /\.md$/,
loader: require.resolve('raw-loader'),
},
// "file" loader makes sure those assets get served by WebpackDevServer.
// When you `import` an asset, you get its (virtual) filename.
// In production, they would get copied to the `build` folder.
Expand Down
12 changes: 10 additions & 2 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,12 @@ module.exports = {
importLoaders: 2,
minimize: true,
sourceMap: shouldUseSourceMap,
modules: process.env.CSS_MODULES ? process.env.CSS_MODULES == 'true' : true,
modules: process.env.CSS_MODULES
? process.env.CSS_MODULES == 'true'
: true,
camelCase: true,
localIdentName: '[path][name]__[local]--[hash:base64:5]',
localIdentName:
'[path][name]__[local]--[hash:base64:5]',
},
},
{
Expand Down Expand Up @@ -244,6 +247,11 @@ module.exports = {
),
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
},
// This loader will load markdown files as raw string.
{
test: /\.md$/,
loader: require.resolve('raw-loader'),
},
// "file" loader makes sure assets end up in the `build` folder.
// When you `import` an asset, you get its filename.
// This loader doesn't use a "test" so it will catch all modules
Expand Down
21 changes: 11 additions & 10 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@
"eslint": "~4.15.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-import-resolver-webpack": "^0.8.1",
"identity-obj-proxy": "3.0.0",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.6",
"stylelint": "~8.4.0",
"stylelint-config-css-modules": "^1.0.0",
"stylelint-config-standard": "^18.0.0",
"stylelint-declaration-use-variable": "^1.6.0",
"stylelint-order": "^0.5.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "^2.8.0",
Expand All @@ -55,14 +47,23 @@
"file-loader": "1.1.5",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"identity-obj-proxy": "3.0.0",
"jest": "20.0.4",
"node-sass": "^4.5.3",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.8",
"promise": "8.0.1",
"raf": "3.4.0",
"raw-loader": "^0.5.1",
"react-dev-utils": "^4.2.1",
"sass-loader": "^6.0.6",
"style-loader": "0.19.0",
"stylelint": "~8.4.0",
"stylelint-config-css-modules": "^1.0.0",
"stylelint-config-standard": "^18.0.0",
"stylelint-declaration-use-variable": "^1.6.0",
"stylelint-order": "^0.5.0",
"sw-precache-webpack-plugin": "0.11.4",
"url-loader": "0.6.2",
"webpack": "3.8.1",
Expand All @@ -71,10 +72,10 @@
"whatwg-fetch": "2.0.3"
},
"devDependencies": {
"normalize.css": "^7.0.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-hot-loader": "next",
"normalize.css": "^7.0.0"
"react-hot-loader": "next"
},
"optionalDependencies": {
"fsevents": "1.1.2"
Expand Down
Loading