title: 404 error in Vue.js project during 'npm build' and serve in Apache Tomcat
body: <p>I created a Vue.js project with following configuration in package.json</p>
  <pre><code>&quot;scripts&quot;: {
      &quot;serve&quot;: &quot;vue-cli-service serve&quot;,
      &quot;build&quot;: &quot;vue-cli-service build&quot;,
      &quot;lint&quot;: &quot;vue-cli-service lint&quot;
    },
    &quot;dependencies&quot;: {
      &quot;axios&quot;: &quot;^0.19.2&quot;,
      &quot;core-js&quot;: &quot;^3.6.5&quot;,
      &quot;http-proxy-middleware&quot;: &quot;^1.0.5&quot;,
      &quot;vee-validate&quot;: &quot;^3.3.7&quot;,
      &quot;vue&quot;: &quot;^2.6.11&quot;,
      &quot;vue-router&quot;: &quot;^3.4.0&quot;,
      &quot;vue-sanitize&quot;: &quot;^0.2.0&quot;,
      &quot;vuex&quot;: &quot;^3.5.1&quot;
    },
  </code></pre>
  <p>I can test the project at the url <a href="http://127.0.0.1:8080/test/test" rel="nofollow noreferrer">http://127.0.0.1:8080/test/test</a> after running <code>npm run serve</code>.</p>
  <p>However, when I built the project with <code>npm run build</code> and moved the dist folder to Apache Tomcat, I get a 404 error for the url <a href="http://127.0.0.1:8080/vue/test/test" rel="nofollow noreferrer">http://127.0.0.1:8080/vue/test/test</a> (vue is the folder where the dist contents are placed).</p>
  <p>I checked the browser console and see the following error.</p>
  <blockquote>
  <p>GET http://localhost:8080/vue/test/test [HTTP/1.1 404  5ms]</p>
  </blockquote>
  <p>Here is the router configuration.</p>
  <pre><code>export default new Router({
  mode : 'history',
  base: '/vue/',
  routes : [
          {
              path : '/:param1/:param2',                
              name : 'comp1',
              component : comp1,
              props : true
          }
        ]})
  </code></pre>
  <p><strong>Update:</strong> I also followed the steps described in this answer to set a base path in the Router, but it still doesnt work. <a href="https://stackoverflow.com/a/60635441/6352160">https://stackoverflow.com/a/60635441/6352160</a>
  How can I debug this error? Why would the same code fail on <code>npm run build</code> and deploy, but work on <code>npm run serve</code>?</p>