Skip to content

Commit 998b798

Browse files
committed
Keep CDN URL for Vercel build
1 parent 59021cf commit 998b798

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const config = {
2121
ENV: process.env.NODE_ENV,
2222
VERSION_LATEST: process.env.VERSION_LATEST,
2323
VERSION_NEXT: process.env.VERSION_NEXT,
24+
VERCEL: process.env.VERCEL,
2425
},
2526
swcMinify: false,
2627
webpack: (config, options) => {

src/common/CompilerManagerHook.res

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ module LoadScript = {
3535
}
3636

3737
module CdnMeta = {
38-
let getCompilerUrl = (version): string =>
39-
`/playground-bundles/${Semver.toString(version)}/compiler.js`
38+
let baseUrl = switch Node.Process.env->Dict.get("VERCEL") {
39+
| Some(_) => "https://cdn.rescript-lang.org"
40+
| None => "/playground-bundles"
41+
}
42+
43+
let getCompilerUrl = (version): string => `${baseUrl}/${Semver.toString(version)}/compiler.js`
4044

4145
let getLibraryCmijUrl = (version, libraryName: string): string =>
42-
`/playground-bundles/${Semver.toString(version)}/${libraryName}/cmij.js`
46+
`${baseUrl}/${Semver.toString(version)}/${libraryName}/cmij.js`
4347

4448
let getStdlibRuntimeUrl = (version, filename) =>
45-
`/playground-bundles/${Semver.toString(version)}/compiler-builtins/stdlib/${filename}`
49+
`${baseUrl}/${Semver.toString(version)}/compiler-builtins/stdlib/${filename}`
4650
}
4751

4852
module FinalResult = {

0 commit comments

Comments
 (0)