Created
July 27, 2020 19:45
-
-
Save eralston/40ead2d19cc9a251627c060fd1a09ddc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://webpack.js.org/loaders/raw-loader/ | |
npm install raw-loader --save-dev | |
// In webpack.config.js | |
module.exports = { | |
... | |
module: { | |
rules: [ | |
... | |
{ | |
test: /\.xml$/i, | |
use: 'raw-loader' | |
} | |
] | |
}, | |
... | |
} | |
// In xml.d.ts | |
declare module "*.xml" { | |
const content: any; | |
export default content; | |
} | |
// In consuming file | |
import exampleXml from './data/example.xml' | |
loadFile (): string { | |
// Basic example of using the imported module, which is itself a string | |
return esbSoapXml | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment