Skip to content

Instantly share code, notes, and snippets.

@ogonkov
Last active August 21, 2020 13:18
Show Gist options
  • Save ogonkov/0ca19648bebabf8ce2d3cfbb5a82b5e0 to your computer and use it in GitHub Desktop.
Save ogonkov/0ca19648bebabf8ce2d3cfbb5a82b5e0 to your computer and use it in GitHub Desktop.
expose-loader bug
require('./test.xml');
fest.app();
{
"name": "expose-loader-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"expose-loader": "^1.0.0",
"raw-loader": "^4.0.1",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"xml2js": "^0.4.23"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<fest:template xmlns:fest="http://fest.mail.ru" context_name="json">
<div>
Hello, world
</div>
</fest:template>
module.exports = {
devtool: false,
module: {
rules: [
{
test: /\.xml$/,
use: [
{
loader: 'expose-loader',
options: {
exposes: 'fest.app'
}
},
{
loader: 'raw-loader',
options: {
esModule: false
}
}
]
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment