allow routes to be specified
This commit is contained in:
parent
9879a03e03
commit
c05fd94028
@ -48,6 +48,7 @@ let
|
|||||||
name,
|
name,
|
||||||
src,
|
src,
|
||||||
nodePackages ? null,
|
nodePackages ? null,
|
||||||
|
routes ? [ "/" ],
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
nodeSource = symlinkJoin {
|
nodeSource = symlinkJoin {
|
||||||
@ -56,6 +57,12 @@ let
|
|||||||
builderPkg.lib
|
builderPkg.lib
|
||||||
] ++ (if nodePackages != null then [ nodePackages ] else [ ]);
|
] ++ (if nodePackages != null then [ nodePackages ] else [ ]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
baseWebpackConfig = builtins.readFile ./webpack.config.js;
|
||||||
|
webpackConfig = ''
|
||||||
|
const ROUTES = ${builtins.toJSON routes}
|
||||||
|
'' + "\n" + baseWebpackConfig;
|
||||||
|
webpackConfigFile = pkgs.writeText "${name}-webpack-config" webpackConfig;
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
inherit name;
|
inherit name;
|
||||||
@ -70,7 +77,7 @@ let
|
|||||||
|
|
||||||
patchPhase = ''
|
patchPhase = ''
|
||||||
ln -sf ${nodeSource}/node_modules .
|
ln -sf ${nodeSource}/node_modules .
|
||||||
cp ${./webpack.config.js} webpack.config.js
|
cp ${webpackConfigFile} webpack.config.js
|
||||||
'';
|
'';
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
const ROUTES = ['/', '/about', '/404', '/posts', '/posts/viveahk', '/posts/librebasics']
|
|
||||||
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
const PrerenderSPAPlugin = require('prerender-spa-plugin')
|
const PrerenderSPAPlugin = require('prerender-spa-plugin')
|
||||||
|
Loading…
Reference in New Issue
Block a user