Skip to content

Instantly share code, notes, and snippets.

@eralston
Created July 27, 2020 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eralston/40ead2d19cc9a251627c060fd1a09ddc to your computer and use it in GitHub Desktop.
Save eralston/40ead2d19cc9a251627c060fd1a09ddc to your computer and use it in GitHub Desktop.
// 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