Created
December 14, 2018 22:43
-
-
Save MrLeebo/9e29de7c1ec537a70bd1ce1bfb863cf8 to your computer and use it in GitHub Desktop.
Demonstration of webpack w/ xml-loader (filenames containing "-" represent folders) https://dist-qwxwourdxw.now.sh/
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<script src="main.js"></script> | |
</body> | |
</html> |
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
{ | |
"name": "xml-loader-demo", | |
"private": true, | |
"scripts": { | |
"start": "webpack-dev-server", | |
"build": "webpack", | |
"deploy": "now dist/" | |
}, | |
"devDependencies": { | |
"webpack": "^4.27.1", | |
"webpack-cli": "^3.1.2", | |
"webpack-dev-server": "^3.1.10", | |
"xml-loader": "^1.2.1" | |
} | |
} |
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
<data>Hello, World!</data> |
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
const {data} = require('./data.xml') | |
document.body.append(data) |
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
const path = require('path'); | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
filename: '[name].js', | |
path: path.resolve(__dirname, 'dist') | |
}, | |
mode: "development", | |
module: { | |
rules: [ | |
{ test: /\.xml$/, loader: 'xml-loader' } | |
] | |
}, | |
devServer: { | |
contentBase: path.join(__dirname, 'dist'), | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment