Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix copying "dev-404-page.js" to the cache folder on Windows #3627

Merged
merged 7 commits into from
Jan 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

exports[`Load plugins Loads plugins defined with an object but without an option key 1`] = `
Array [
Object {
"id": "Plugin dev-404-page",
"name": "dev-404-page",
"nodeAPIs": Array [
"createPages",
],
"pluginOptions": Object {
"plugins": Array [],
},
"resolve": "",
"version": "1.0.0",
},
Object {
"id": "Plugin component-page-creator",
"name": "component-page-creator",
Expand Down Expand Up @@ -39,18 +51,6 @@ Array [
"resolve": "",
"version": "1.0.0",
},
Object {
"id": "Plugin dev-404-page",
"name": "dev-404-page",
"nodeAPIs": Array [
"createPages",
],
"pluginOptions": Object {
"plugins": Array [],
},
"resolve": "",
"version": "1.0.0",
},
Object {
"id": "Plugin prod-404",
"name": "prod-404",
Expand Down Expand Up @@ -99,6 +99,18 @@ Array [

exports[`Load plugins load plugins for a site 1`] = `
Array [
Object {
"id": "Plugin dev-404-page",
"name": "dev-404-page",
"nodeAPIs": Array [
"createPages",
],
"pluginOptions": Object {
"plugins": Array [],
},
"resolve": "",
"version": "1.0.0",
},
Object {
"id": "Plugin component-page-creator",
"name": "component-page-creator",
Expand Down Expand Up @@ -136,18 +148,6 @@ Array [
"resolve": "",
"version": "1.0.0",
},
Object {
"id": "Plugin dev-404-page",
"name": "dev-404-page",
"nodeAPIs": Array [
"createPages",
],
"pluginOptions": Object {
"plugins": Array [],
},
"resolve": "",
"version": "1.0.0",
},
Object {
"id": "Plugin prod-404",
"name": "prod-404",
Expand Down
6 changes: 3 additions & 3 deletions packages/gatsby/src/bootstrap/load-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ module.exports = async (config = {}) => {
}

// Add internal plugins
plugins.push(
processPlugin(path.join(__dirname, `../internal-plugins/dev-404-page`))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was related to the fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure, but examining the code lead me to the conclusion that the plugin loading order might be relevant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, it would make the copying run earlier which might matter for some reason haha 👍

)
plugins.push(
processPlugin(
path.join(__dirname, `../internal-plugins/component-page-creator`)
Expand All @@ -148,9 +151,6 @@ module.exports = async (config = {}) => {
path.join(__dirname, `../internal-plugins/internal-data-bridge`)
)
)
plugins.push(
processPlugin(path.join(__dirname, `../internal-plugins/dev-404-page`))
)
plugins.push(
processPlugin(path.join(__dirname, `../internal-plugins/prod-404`))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports.createPages = async ({ store, boundActionCreators }) => {
const currentPath = path.join(__dirname, `./raw_dev-404-page.js`)
const newPath = path.join(program.directory, `.cache`, `dev-404-page.js`)

fs.copySync(currentPath, newPath)
await fs.copy(currentPath, newPath)

createPage({
component: newPath,
Expand Down