-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrspack.config.js
84 lines (80 loc) · 1.69 KB
/
rspack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* @type {import('@rspack/cli').Configuration}
*/
let apiUrl = (process.env.NODE_ENV === 'development') ? "http://api-dev.127-0-0-1.nip.io" : "https://center-api.runtime.land";
if (process.env.API_URL) {
apiUrl = process.env.API_URL;
}
let clerkKey = "";
let useClerkJS = !!process.env.CLERK_JS;
if (useClerkJS) {
clerkKey = (process.env.NODE_ENV === 'development') ? "pk_test_cGV0LW1vb3NlLTc1LmNsZXJrLmFjY291bnRzLmRldiQ" : "pk_live_Y2xlcmsucnVudGltZS5sYW5kJA";
if (process.env.CLERK_KEY) {
clerkKey = process.env.CLERK_KEY;
}
}
console.log("API_URL:", apiUrl);
console.log("CLERK_KEY:", clerkKey)
module.exports = {
context: __dirname,
entry: {
main: "./src/index.jsx",
},
output: {
filename: "[name].[contenthash].bundle.js",
publicPath: "/",
},
target: "web",
builtins: {
html: [
{
template: "./index.html",
title: "Runtime.land | a tiny Function as a Service (FaaS) platform ",
favicon: "./public/logo-v2-small.ico",
},
],
copy: {
patterns: [
{
from: "public/**/*",
},
],
},
define: {
API_URL: "'" + apiUrl + "'",
CLERK_KEY: "'" + clerkKey + "'",
},
},
module: {
rules: [
{
test: /\.svg$/,
type: "asset",
},
{
test: /\.sass|.scss$/,
use: [
{
loader: 'sass-loader',
options: {
// ...
},
},
],
type: 'css',
},
{
test: /\.png$/,
type: "asset",
},
{
test: /\.config.js/,
type: "asset",
},
],
},
devServer: {
hot: true,
historyApiFallback: true,
},
};