setting content type for static javascript files in express
问题 I am using express to serve up a page with js files using es6 modules. About es6 modules - https://jakearchibald.com/2017/es-modules-in-browsers/ my server.js file is - const app = express(); app.use( express.static( __dirname + '/src' )); app.get('*', (req, res) => { res.sendFile(path.join(__dirname + '/index.html')); }); app.listen(8080, () => console.log('Listening on port 8080!')); and my index.html is - <html lang="en"> <body> <script type="module" src="./src/test.js"></script> </body> <