diff --git a/config/paths.js b/config/paths.js index 7c6ed3d9f..182dfe612 100644 --- a/config/paths.js +++ b/config/paths.js @@ -26,7 +26,7 @@ function ensureSlash(inputPath, needsSlash) { } const getPublicUrl = appPackageJson => - envPublicUrl || process.env.BUILD_ENV !== 'development' ? require(appPackageJson).homepage : ''; + envPublicUrl || process.env.BUILD_ENV !== 'development' && process.env.NETLIFY !== 'true' ? require(appPackageJson).homepage : ''; // We use `PUBLIC_URL` environment variable or "homepage" field to infer // "public path" at which the app is served. diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 000000000..1f5cfffd1 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,10 @@ +# Global settings applied to the whole site. +# +# “publish” is the directory to publish (relative to root of your repo), +# “command” is your build command, +# “base” is directory to change to before starting build. if you set base: +# that is where we will look for package.json/.nvmrc/etc not repo root! + +[build] + publish = "build" + command = "npm run build-doc:netlify" diff --git a/package.json b/package.json index 714f21d40..580882faa 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "scripts": { "build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/", "build-doc": "node scripts/build.js && cp build/index.html build/404.html", + "build-doc:netlify": "npm run build && NETLIFY=true npm run build-doc", "build-js": "node scripts/build.js", "build:lint:fix": "npm run build:lint -- --fix", "build:lint": "eslint 'src/**' --ext .js,.jsx --env browser,node",