[Poi] Use Markdown as React Components by Adding a Webpack Loader to Poi
2023-09-14 09:00:50 时间
Poi ships with many webpack loaders included, but you may run into scenarios where you'll need to customize and add your own. This lesson covers adding react-markdown-loader
to Poi to load Markdown files as React components.
Install:
npm i -D react-markdown-loader
poi.config.js:
module.exports = { webpack(config) { config.module.rules.push({ test: '/.md$/', loaders: [ 'babel-loader', 'react-markdown-loader' ] }) return config; } }
import Page from './Page.md' import {render} from 'react-dom'; render( <Page></Page>, document.getElementById('app') );
相关文章
- 前端架构gulp与webpack(知识点整理)
- dva+react+antd+webpack 项目开发配置
- React+Webpack+ES6 兼容低版本浏览器(IE9)解决方案
- [React] Override webpack config for create-react-app without ejection
- [Webpack 2] Add Code Coverage to tests in a Webpack project
- [React + webpack] hjs-webpack
- webpack中引入的path[require('path')]是node.js内置的package,用来处理路径的。
- 高性能流媒体服务器EasyDSS前端重构(四)- webpack + video.js 打造流媒体服务器前端
- express起一个代理服务器,webpack-dev-server同时起多个
- [Webpack 2] Expose modules to dependencies with Webpack
- [AngularJS + Webpack] Requiring CSS & Preprocessors
- [AngularJS + Webpack] require directives
- 简要分析webpack打包后代码
- webpack最简单的入门教程里bundle.js之运行单步调试的原理解析