webpack/examples/custom-json-modules/webpack.config.js

38 lines
534 B
JavaScript
Raw Normal View History

2019-11-29 01:12:11 +08:00
const toml = require("toml");
const json5 = require("json5");
const yaml = require("yamljs");
2019-11-29 01:12:11 +08:00
module.exports = {
module: {
rules: [
{
test: /\.toml$/,
type: "json",
parser: {
parse(input) {
return toml.parse(input);
}
}
},
{
2019-11-29 23:15:04 +08:00
test: /\.json5$/,
type: "json",
parser: {
parse(input) {
return json5.parse(input);
}
}
},
{
test: /\.yaml$/,
type: "json",
parser: {
parse(input) {
return yaml.parse(input);
}
}
2019-11-29 01:12:11 +08:00
}
]
}
};