From 90458982ce82eb69317ddebcb9737b971ef12634 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Wed, 29 Jul 2020 12:38:00 +0200 Subject: [PATCH] fix: serve public/assets with webpack-dev-server --- README.md | 10 ++++++---- package.json | 2 +- webpack.dev.js | 4 ++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e9067fac6..41ce16e7e 100644 --- a/README.md +++ b/README.md @@ -69,11 +69,13 @@ This repo contains the core code used in the web app, as well as the Electron-ba **Instructions:** 1. Clone the repo -2. `npm install` -3. `cp index.html.sample index.html` -4. `npm start` +1. `bundle install` +1. `npm install` +1. `bundle exec rails assets:precompile` +1. `cp index.html.sample index.html` +1. `npm start` -Then open your browser to `http://localhost:3000`. +Then open your browser to `http://localhost:3001`. --- diff --git a/package.json b/package.json index 299e17c5c..b0b491c48 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "start": "webpack-dev-server --progress --config webpack.dev.js", "watch": "webpack -w --config webpack.dev.js", "bundle": "webpack --config webpack.prod.js", - "build": "bundle install && npm install && npm run bundle", + "build": "bundle install && npm ci && bundle exec rails assets:precompile && npm run bundle", "submodules": "git submodule update --init --force --remote", "lint": "eslint --fix app/assets/javascripts/**/*.js", "tsc": "tsc --project app/assets/javascripts/tsconfig.json" diff --git a/webpack.dev.js b/webpack.dev.js index d43339d5f..92530e4ff 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -11,6 +11,10 @@ module.exports = (_env, argv) => { '/extensions': { target: `http://localhost:${port}`, pathRewrite: { '^/extensions': '/public/extensions' } + }, + '/assets': { + target: `http://localhost:${port}`, + pathRewrite: { '^/assets': '/public/assets' } } }, port,