Word document to raw html loader for Webpack
npm install docx-loaderWebpack loader from docx to html raw.
npm i docx-loader --save-dev
or
yarn add docx-loader -D
#
``javascript`
{
test: /\.docx$/,
use: [
{
loader: "docx-loader",
options: {
removeLinks: true
}
}
]
}
You can also add options
`javascript`
options: {
removeLinks: true,
mammoth: { // we're using mammoth npm package for docx2html
styleMap: [
"p[style-name='Section Title'] => h1:fresh",
"p[style-name='Subsection Title'] => h2:fresh"
]
},
}
` document.body.innerHtml = demo; or with React `javascript
import demo from "./demo.docx";
console.log(demo); // Demo...
`javascript``
import demo from "./demo.docx";
export default ;