webpack/test/configCases/custom-modules/json-custom/webpack.config.js

44 lines
740 B
JavaScript
Raw Normal View History

2019-11-29 01:12:11 +08:00
const toml = require("toml");
const NormalModule = require("../../../../lib/NormalModule");
module.exports = [
{
mode: "development",
module: {
rules: [
{
test: /\.toml$/,
type: "json",
parser: {
parse(input, module) {
expect(typeof input).toBe("string");
expect(module).toBeInstanceOf(NormalModule);
return toml.parse(input);
}
}
}
]
}
},
{
mode: "development",
module: {
rules: [
{
test: /\.toml$/,
type: "json",
parser: {
parse(input, module) {
expect(typeof input).toBe("string");
expect(module).toBeInstanceOf(NormalModule);
return JSON.stringify(toml.parse(input));
}
}
}
]
}
}
];