Skip to content

Commit

Permalink
change assets paths and include new build into server hot reload
Browse files Browse the repository at this point in the history
  • Loading branch information
sdumetz committed Jan 5, 2024
1 parent 611b530 commit f19809d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
12 changes: 7 additions & 5 deletions source/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,18 @@ export default async function createServer(config = defaultConfig) :Promise<expr
const {default: webpack} = await import("webpack");
const {default: middleware} = await import("webpack-dev-middleware");
//@ts-ignore
const {default: config} = await import("../ui/webpack.config.js");
const compiler = webpack(config());
const {default: configGenerator} = await import("../ui/webpack.config.js");

const compiler = webpack(configGenerator());
const webpackInstance = middleware(compiler as any, {});
app.use(webpackInstance);
app.use("/dist", webpackInstance);
await new Promise(resolve=> webpackInstance.waitUntilValid(resolve));
}else{
// static file server
app.use("/", express.static(config.dist_dir));
app.use("/dist", express.static(config.dist_dir));

}
app.use("/", express.static(config.assets_dir));


app.use("/libs", (await import("./routes/libs/index.js")).default);

Expand Down
4 changes: 2 additions & 2 deletions source/server/templates/explorer.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

<voyager-explorer resourceroot="/" root="/scenes/{{scene}}/" referrer="{{referrer}}" lang="{{lang}}"></voyager-explorer>
<script type="text/javascript" src="/js/explorer.js"></script>
<voyager-explorer resourceroot="/dist/" root="/scenes/{{scene}}/" referrer="{{referrer}}" lang="{{lang}}"></voyager-explorer>
<script type="text/javascript" src="/dist/js/voyager-explorer.min.js"></script>
2 changes: 1 addition & 1 deletion source/server/templates/home.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

<ecorpus-main></ecorpus-main>
<script src="/js/corpus.js"></script>
<script src="/dist/js/corpus.js"></script>
4 changes: 2 additions & 2 deletions source/server/templates/layouts/main.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

<title>{{title}}</title>

<link rel="shortcut icon" type="image/png" href="/images/logo-ecorpus.png"/>
<link rel="shortcut icon" type="image/png" href="/dist/favicon.png"/>

<style>
body { background: #303030; }
</style>
<link rel="stylesheet" href="/css/corpus.css">
<link rel="stylesheet" href="/dist/css/corpus.css">

</head>
<body>
Expand Down
6 changes: 3 additions & 3 deletions source/server/templates/story.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

<voyager-story resourceRoot="/" root="/scenes/{{scene}}/" referrer="{{referrer}}" lang="{{lang}}" mode="{{mode}}"></voyager-story>
<script type="text/javascript" src="/js/story.js"></script>
<link rel="stylesheet" href="/css/story.css">
<voyager-story resourceRoot="/dist/" root="/scenes/{{scene}}/" referrer="{{referrer}}" lang="{{lang}}" mode="{{mode}}"></voyager-story>
<script type="text/javascript" src="/dist/js/voyager-story.min.js"></script>
<link rel="stylesheet" href="/dist/css/voyager-story.min.css">

0 comments on commit f19809d

Please sign in to comment.