thelounge/webpack.config-test.js

34 lines
1,010 B
JavaScript
Raw Normal View History

"use strict";
2019-11-12 16:51:40 +01:00
const webpack = require("webpack");
const path = require("path");
const config = require("./webpack.config.js");
config.target = "node";
2018-09-04 22:18:17 +02:00
config.devtool = "eval";
// Add the istanbul plugin to babel-loader options
for (const rule of config.module.rules) {
if (rule.use.loader === "babel-loader") {
2019-07-17 11:33:59 +02:00
rule.use.options.plugins = ["istanbul"];
}
}
2018-01-25 19:32:28 +01:00
// `optimization.splitChunks` is incompatible with a `target` of `node`. See:
// - https://github.com/zinserjan/mocha-webpack/issues/84
// - https://github.com/webpack/webpack/issues/6727#issuecomment-372589122
config.optimization.splitChunks = false;
2019-11-12 16:51:40 +01:00
// "Fixes" Critical dependency: the request of a dependency is an expression
config.plugins.push(new webpack.ContextReplacementPlugin(/vue-server-renderer$/));
// Client tests that require Vue may end up requireing socket.io
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/js(\/|\\)socket\.js/,
path.resolve(__dirname, "scripts/noop.js")
)
);
module.exports = config;