Skip to content

Commit

Permalink
Hopefully fixed issue with redirecting
Browse files Browse the repository at this point in the history
  • Loading branch information
erikhallaraaker committed Oct 25, 2018
1 parent ecb5a75 commit 95d474a
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 25 deletions.
37 changes: 37 additions & 0 deletions build/root404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-3440932-20"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag("js", new Date());
gtag("config", "UA-3440932-20");
</script>
<noscript>
<div class="container">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-body">
<h2>Welcome to the PayEx DesignGuide</h2>
<p>You need to <b>enable javascript</b> to use this site</p>
</div>
</div>
</div>
</div>
</noscript>
<script>
(function () {
var basename = "<%= htmlWebpackPlugin.options.basename %>";
window.location = "https://design.payex.com" + basename + "404";
})();
</script>
</body>
</html>
37 changes: 37 additions & 0 deletions build/rootindex.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-3440932-20"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag("js", new Date());
gtag("config", "UA-3440932-20");
</script>
<noscript>
<div class="container">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-body">
<h2>Welcome to the PayEx DesignGuide</h2>
<p>You need to <b>enable javascript</b> to use this site</p>
</div>
</div>
</div>
</div>
</noscript>
<script>
(function () {
var basename = "<%= htmlWebpackPlugin.options.basename %>";
window.location = "https://design.payex.com" + basename;
})();
</script>
</body>
</html>
3 changes: 0 additions & 3 deletions tools/404-redir.js

This file was deleted.

3 changes: 0 additions & 3 deletions tools/base-redir.js

This file was deleted.

31 changes: 12 additions & 19 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,7 @@ module.exports = (env, argv) => {
new HtmlWebpackPlugin({
template: "./src/index.html",
hash: true,
title: "PayEx DesignGuide",
excludeChunks: [
"base-redir",
"runtime~base-redir",
"404-redir",
"runtime~404-redir"
]
title: "PayEx DesignGuide"
}),
new AppManifestWebpackPlugin({
logo: "./src/img/favicon.png",
Expand Down Expand Up @@ -303,29 +297,28 @@ module.exports = (env, argv) => {
if (isRelease) {
const rootPath = levelsToRoot(basename);

config.entry["base-redir"] = "./tools/base-redir.js";
config.entry["404-redir"] = "./tools/404-redir.js";

config.plugins.push(
new HtmlWebpackPlugin({
filename: `${rootPath}index.html`,
template: "./src/index.html",
template: "./build/rootindex.html",
hash: true,
title: "PayEx DesignGuide",
chunks: ["base-redir", "runtime~base-redir"]
chunks: ["px"],
basename
}),
new HtmlWebpackPlugin({
filename: `${rootPath}404.html`,
template: "./src/index.html",
template: "./build/root404.html",
hash: true,
chunks: ["px"],
title: "PayEx DesignGuide",
chunks: ["404-redir", "runtime~404-redir"]
basename
}),
new SentryCliPlugin({
release: version,
include: ".",
ignore: ["node_modules", "webpack.config.js"]
})
// new SentryCliPlugin({
// release: version,
// include: ".",
// ignore: ["node_modules", "webpack.config.js"]
// })
);
}

Expand Down

0 comments on commit 95d474a

Please sign in to comment.