When I run "ng build" I noticed that it creates a folder structure like this.
/dist/projectname/
Then it generates all the files in the projectname folder.
When I run my Angular app I get a 404 (Not found) error for the first script in the index file.
<body>
<app-root></app-root>
<script src="runtime-es2015.js" type="module"></script>
<script src="runtime-es5.js" nomodule defer></script>
<script src="polyfills-es5.js" nomodule defer></script>
<script src="polyfills-es2015.js" type="module"></script>
<script src="styles-es2015.js" type="module"></script>
<script src="styles-es5.js" nomodule defer></script>
<script src="vendor-es2015.js" type="module"></script>
<script src="vendor-es5.js" nomodule defer></script>
<script src="main-es2015.js" type="module"></script>
<script src="main-es5.js" nomodule defer></script>
</body>
- Should they not have src="projectname/runtime-es2015.js" in them?
- How can I get build to not build with a project name folder?
- Is there something I can do in my code to reference the projectname folder since it doesn't assume it?
Additionally here is my server.js file since I feel like this is where the issues are coming from.
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const http = require('http');
const app = express();
const api = require('./server/routes/api');
// Parsers
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, 'dist')));
app.use('/api', api);
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'dist/clinic-manager/index.html'));
});
// Set Port
const port = process.env.PORT || '3000';
app.set('port', port);
const server = http.createServer(app);
server.listen(port, () => console.log(`Running on localhost:${port}`));
Thank you in advance for any help offered!