From 2e3d9a6265d4c0d0168729a60b319bea236e098b Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sat, 21 May 2022 13:45:42 -0500 Subject: [PATCH] Fix yarn dev (#4574) * Fix yarn dev and yarn test --- src/plugins/dev-server.js | 2 +- webpack.config.js | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/plugins/dev-server.js b/src/plugins/dev-server.js index 1da841e8..e1c5e48c 100644 --- a/src/plugins/dev-server.js +++ b/src/plugins/dev-server.js @@ -6,7 +6,7 @@ module.exports = (app) => { log.debug("Starting server in development mode"); const webpack = require("webpack"); - const webpackConfig = require("../../webpack.config.js"); + const webpackConfig = require("../../webpack.config.js")(undefined, {mode: "production"}); webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); webpackConfig.entry["js/bundle.js"].push( diff --git a/webpack.config.js b/webpack.config.js index 86357f88..018533a5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,7 +1,6 @@ "use strict"; const webpack = require("webpack"); -const fs = require("fs"); const path = require("path"); const CopyPlugin = require("copy-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); @@ -17,6 +16,7 @@ const config = { }, devtool: "source-map", output: { + clean: true, // Clean the output directory before emit. path: path.resolve(__dirname, "public"), filename: "[name]", publicPath: "/", @@ -144,12 +144,6 @@ const config = { module.exports = (env, argv) => { if (argv.mode === "development") { - const testFile = path.resolve(__dirname, "test/public/testclient.js"); - - if (fs.existsSync(testFile)) { - fs.unlinkSync(testFile); - } - config.target = "node"; config.devtool = "eval"; config.stats = "errors-only"; @@ -173,7 +167,9 @@ module.exports = (env, argv) => { // Disable plugins like copy files, it is not required config.plugins = [ new VueLoaderPlugin(), - + new MiniCssExtractPlugin({ + filename: "css/style.css", + }), // Client tests that require Vue may end up requireing socket.io new webpack.NormalModuleReplacementPlugin( /js(\/|\\)socket\.js/,