// 不自动运行:webpack loader,由 webpack 调用 // loader 是一个函数:输入文件内容,返回 JS 代码字符串 module.exports = function mdLoader(source) { const { trim = false } = this.getOptions(); const text = trim ? source.trim() : source; return `export default ${JSON.stringify(text)};`; };