diff --git a/client/configuration/eslint/eslint.js b/client/configuration/eslint/eslint.js index 66637c26..21fbfe8d 100644 --- a/client/configuration/eslint/eslint.js +++ b/client/configuration/eslint/eslint.js @@ -64,6 +64,12 @@ module.exports = { "LabeledStatement", "WithStatement", ], + "import/no-extraneous-dependencies": [ + "error", + { + devDependencies: true, + }, + ], }, overrides: [ { diff --git a/client/configuration/webpack/webpack.config.dev.js b/client/configuration/webpack/webpack.config.dev.js index e0881c0a..1295d6dc 100644 --- a/client/configuration/webpack/webpack.config.dev.js +++ b/client/configuration/webpack/webpack.config.dev.js @@ -31,7 +31,11 @@ const devConfig = { test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2|otf)$/i, loader: "file-loader", include: [nodeModules, fonts], - query: { name: "static/assets/[name].[ext]" }, + query: { + name: "static/assets/[name].[ext]", + // (thuang): This is needed to make sure @font url path is '/static/assets/' + publicPath: "/", + }, }, ], }, diff --git a/client/configuration/webpack/webpack.config.prod.js b/client/configuration/webpack/webpack.config.prod.js index a2115e7f..c92e307f 100644 --- a/client/configuration/webpack/webpack.config.prod.js +++ b/client/configuration/webpack/webpack.config.prod.js @@ -45,7 +45,11 @@ const prodConfig = { test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2|otf)$/i, loader: "file-loader", include: [nodeModules, fonts], - query: { name: "static/assets/[name]-[contenthash].[ext]" }, + query: { + name: "static/assets/[name]-[contenthash].[ext]", + // (thuang): This is needed to make sure @font url path is '../static/assets/' + publicPath: "static/", + }, }, ], }, diff --git a/client/server/development.js b/client/server/development.js index c85b51ff..0b3e3811 100644 --- a/client/server/development.js +++ b/client/server/development.js @@ -1,20 +1,19 @@ -/* eslint-disable */ -// jshint esversion: 6 -var path = require("path"); -var historyApiFallback = require("connect-history-api-fallback"); -var chalk = require("chalk"); -var express = require("express"); -var favicon = require("serve-favicon"); -var webpack = require("webpack"); -var config = require("../configuration/webpack/webpack.config.dev"); -var utils = require("./utils"); +const path = require("path"); +const historyApiFallback = require("connect-history-api-fallback"); +const chalk = require("chalk"); +const express = require("express"); +const favicon = require("serve-favicon"); +const webpack = require("webpack"); +const devMiddleware = require("webpack-dev-middleware"); +const config = require("../configuration/webpack/webpack.config.dev"); +const utils = require("./utils"); process.env.NODE_ENV = "development"; const CLIENT_PORT = process.env.CXG_CLIENT_PORT; // Set up compiler -var compiler = webpack(config); +const compiler = webpack(config); compiler.plugin("invalid", () => { utils.clearConsole(); @@ -26,12 +25,12 @@ compiler.plugin("done", (stats) => { }); // Launch server -var app = express(); +const app = express(); app.use(historyApiFallback({ verbose: false })); app.use( - require("webpack-dev-middleware")(compiler, { + devMiddleware(compiler, { logLevel: "warn", publicPath: config.output.publicPath, })