I have a site hosted on github pages using Jekyll.
Essentially all I want to get Webpack server to load up :
http://localhost:8080/project/ - with the added feature being /project/ to make all my urls continue to work locally.
More on Jekyll setup:
To get all the url's working on github pages you have to set the base url: baseurl: "/project/" then when you reference a url you use:
<a href="{{ "page-1/" | prepend: site.baseurl }}">
which would output to
<a href="/project/page-1/">
I want to replicate this url structure with webpack middleware.
Firstly I set the webpack dev server to look at the built Jekyll site:
devServer: {
contentBase: '_site/', //disk location
watchContentBase: true
},
Then to make sure the files are served from /project/ I have added:
output: {
filename: 'js/app.js',
path: path.resolve(__dirname, ''),
},
I don't have Webpack building any html with HtmlWebpackPlugin, as that's what Jekyll is doing, so HTML webpack is not an option. Maybe some kind of express static server?
I have tried this but it doesn't seem to do anything :(
const express = require('express');
setup(app){
app.use('_site/', express.static('/project/'));
}
Thanks.