1

So I have this dev environment through work, and sometimes i can go 20 minutes or so without restarting the server, but most of the time its every little change. this is the error message that pops up enter image description here

This is my webpack config

var webpack = require("webpack");
var path = require("path");
var SaveHashes = require("assets-webpack-plugin");
var config = require("config");

//used to read in command line args
const args = require('yargs').argv;

var useConfig;

if (args.env && args.env.useConfig){
    useConfig = args.env.useConfig; //must match a key of a configuration
} else {
    useConfig = config.get("useConfig"); //must match a key of a configuration
}

//define config object
var configuration = config.get(useConfig); //the configuration object that has the key of useConfig

var router = ["regenerator-runtime/runtime", "./react/router.jsx"];

if (configuration.router) {
    router = configuration.router;
}

//define global webpack variables that go into definePlugin
var release = (args.env && args.env.BUILD_RELEASE === "true");

var definePlugin = new webpack.DefinePlugin({
    __DEV__: !release,
    __RELEASE__: release,
    __HMR__: true
});

module.exports = {
    entry: {
        router: router
    },
    output: {
        path: path.join(__dirname, "public", "javascripts"),
        filename: "router-bundle.js",
        publicPath: "http://<IP>:8080/javascripts/" // Relative to public folder
    },
    module: {
        loaders: [
            { test: /\.(wav|ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, loader: "file-loader" },
            { test: /\.pug$/, loader: "pug-loader" },
            { test: /\.css$/, loader: "style-loader!css-loader" },
            { test: /\.scss$/, loader: "style-loader!css-loader!sass-loader" },
            { test: /\.(png|jpg)$/, loader: "url-loader?limit=32768" },
            {
                test: /.jsx?$/,
                loader: "babel-loader",
                exclude: /node_modules/,
                query: { presets: ["env", "react", "stage-2"] }
            },
            {
                test: /.js?$/,
                loader: "babel-loader",
                exclude: /node_modules/,
                query: { presets: ["env", "react", "stage-2"] }
            },
            { test: /\.json$/, loader: "json-loader" }
        ]
    },
    node: { fs: "empty" },
    externals: {
        react: "React",
        "react-dom": "ReactDOM",
        uiplugin: "UIFactory",
        "./cptable": "var cptable",
        "./jszip": "jszip"
    },
    resolve: {
        extensions: ["*", ".js", ".jsx"]
    },
    plugins: [definePlugin]
};

I've tried different variations of publicPath value also other different configs with no avail!

webpack version comes up 3.9.1

A faster development process where I don't have to restart the HMR every time I save a file would be nice!

Jacob
  • 105
  • 1
  • 10

0 Answers0