I keep getting this websocket error when I run npm run dev. I'm working in a group of WSL and Mac users and our repo all works for them but I'm the only that gets this issue when trying to run our application. At a loss for why this is happening.
Websocket Error when running npm run dev
This is our webpack configuration file.
var path = require("path");
var HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./src/index.js",
output: {
path: path.join(__dirname, "build"),
publicPath: '/build',
filename: "index_bundle.js"
},
mode: process.env.NODE_ENV,
module: {
rules: [
{
test: /\.tsx?/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.jsx?/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ["@babel/plugin-syntax-jsx"]
},
},
exclude: /npm_modules/
},
{
//npm install -D sass-loader css-loader style-loader webpack
// /\.s[ac]ss$/i
// /\.css /
test: /\.s?css/,
use: ["style-loader", "css-loader", "sass-loader"
],
},
{
// Now we apply rule for images
test: /\.(png|jpg|gif|svg)$/,
use: [
{
// Using file-loader for these files
loader: "file-loader",
// loader: "url-loader",
// In options we can set different things like format
// and directory to save
options: {
outputPath: '/images'
}
}
]
},
// {
// test: /\.(png|jpg)$/,
// loader: 'url-loader'
// },
]
},
resolve: {
// Enable importing JS / JSX files without specifying their extension
extensions: [".js", ".jsx", ".tsx", ".ts"],
},
devServer: {
static: {
directory: path.join(__dirname, '/src'),
},
proxy: {
'/': 'http://localhost:3000'
},
compress: true,
port: 8080,
},
};
Found the answer / a working solution. I changed the port from 8080 in our devServer to 9000 and it worked, I'm not sure why that worked but it did. I also found this a recommended solution in the snowpack.dev docs that say to do the same thing. https://www.snowpack.dev/reference/common-error-details