Disable caching of local generated main.js file (#1193)

This commit is contained in:
Eryu Xia 2022-01-28 21:47:21 -08:00 committed by GitHub
parent eb313c1f3d
commit 4dbd519bc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -19,7 +19,12 @@
<title>Echo Example</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="./dist/main.js"></script>
<script>
// Load the local /dist/main.js and use a random query parameter to disable caching.
const script = document.createElement('script');
script.src = `./dist/main.js?v=${Date.now()}`;
document.head.appendChild(script);
</script>
</head>
<body>
<div class="container">

View File

@ -19,7 +19,12 @@
<title>Echo Example</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="./dist/main.js"></script>
<script>
// Load the local /dist/main.js and use a random query parameter to disable caching.
const script = document.createElement('script');
script.src = `./dist/main.js?v=${Date.now()}`;
document.head.appendChild(script);
</script>
</head>
<body>
<div class="container">