UNPKG

797 BJavaScriptView Raw
1"use strict";
2
3const path = require(`path`);
4const fs = require(`fs-extra`);
5const chokidar = require(`chokidar`);
6exports.createPagesStatefully = async ({
7 store,
8 actions
9}, options, done) => {
10 if (process.env.NODE_ENV !== `production`) {
11 const {
12 program
13 } = store.getState();
14 const {
15 createPage
16 } = actions;
17 const source = path.join(__dirname, `./raw_dev-404-page.js`);
18 const destination = path.join(program.directory, `.cache`, `dev-404-page.js`);
19 const copy = () => fs.copy(source, destination);
20 await copy();
21 createPage({
22 component: destination,
23 path: `/dev-404-page/`
24 });
25 chokidar.watch(source).on(`change`, () => copy()).on(`ready`, () => done());
26 } else {
27 done();
28 }
29};
30//# sourceMappingURL=gatsby-node.js.map
\No newline at end of file