mirror of https://github.com/webpack/webpack.git
36 lines
690 B
JavaScript
36 lines
690 B
JavaScript
|
const { CachedSource } = require("webpack-sources");
|
||
|
|
||
|
/** @typedef {import("../../../lib/Compilation")} Compilation */
|
||
|
|
||
|
module.exports = {
|
||
|
module: {
|
||
|
rules: [
|
||
|
{
|
||
|
test: /\.wat$/,
|
||
|
loader: "wast-loader",
|
||
|
type: "webassembly/experimental"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
plugins: [
|
||
|
function() {
|
||
|
this.hooks.compilation.tap(
|
||
|
"Test",
|
||
|
/**
|
||
|
* @param {Compilation} compilation Compilation
|
||
|
* @returns {void}
|
||
|
*/
|
||
|
compilation => {
|
||
|
compilation.moduleTemplates.webassembly.hooks.package.tap(
|
||
|
"Test",
|
||
|
source => {
|
||
|
// this is important to make each returned value a new instance
|
||
|
return new CachedSource(source);
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
]
|
||
|
};
|