mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-27 04:46:13 +00:00
new-webpack: serve static files (#567)
Summary: This commit makes the Webpack dev server fully functional under the new config, by serving the static SourceCred directory via a piece of injected middleware. Test Plan: Run ``` NODE_ENV=development node ./node_modules/.bin/webpack-dev-server \ --config config/makeWebpackConfig.js ``` and navigate to the cred explorer. Note that the repository registry is fetched, and the whole cred explorer works. wchargin-branch: webpack-statics
This commit is contained in:
parent
37eddcaf27
commit
1d48bf9390
@ -1,4 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
const express = require("express");
|
||||||
|
/*:: import type {$Application as ExpressApp} from "express"; */
|
||||||
|
const os = require("os");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const ManifestPlugin = require("webpack-manifest-plugin");
|
const ManifestPlugin = require("webpack-manifest-plugin");
|
||||||
@ -38,6 +41,16 @@ function makeConfig(mode /*: "production" | "development" */) {
|
|||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
inline: false,
|
inline: false,
|
||||||
|
before: (app /*: ExpressApp */) => {
|
||||||
|
// TODO(@wchargin): De-duplicate this code.
|
||||||
|
app.use(
|
||||||
|
"/api/v1/data",
|
||||||
|
express.static(
|
||||||
|
process.env.SOURCECRED_DIRECTORY ||
|
||||||
|
path.join(os.tmpdir(), "sourcecred")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
// The build folder.
|
// The build folder.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user