-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrspack.config.js
More file actions
122 lines (120 loc) · 3.69 KB
/
rspack.config.js
File metadata and controls
122 lines (120 loc) · 3.69 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
const { VueLoaderPlugin } = require("vue-loader");
//const autoprefixer = require("autoprefixer");
const path = require("path");
const rspack = require("@rspack/core");
// Helper to create base config
const createBaseConfig = (isOpac = false) => ({
resolve: {
alias: {
// Use Vue 3.5 for islands
"vue": path.resolve(__dirname, "node_modules/vue-3.5"),
"@fetch": path.resolve(
__dirname,
"koha-tmpl/intranet-tmpl/prog/js/fetch"
),
"@bookingApi": path.resolve(
__dirname,
isOpac
? "koha-tmpl/intranet-tmpl/prog/js/vue/components/Bookings/lib/adapters/api/opac.js"
: "koha-tmpl/intranet-tmpl/prog/js/vue/components/Bookings/lib/adapters/api/staff-interface.js"
),
},
},
module: {
rules: [
{
test: /\.vue$/,
loader: "vue-loader",
options: {
experimentalInlineMatchResource: true,
},
exclude: [path.resolve(__dirname, "t/cypress/")],
},
{
test: /\.ts$/,
loader: "builtin:swc-loader",
options: {
jsc: {
parser: {
syntax: "typescript",
},
},
},
exclude: [
/node_modules/,
path.resolve(__dirname, "t/cypress/"),
],
type: "javascript/auto",
},
{
test: /\.css$/i,
type: "javascript/auto",
use: ["style-loader", "css-loader"],
},
],
},
plugins: [
new VueLoaderPlugin(),
new rspack.DefinePlugin({
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false,
// Add environment variable for API module selection
__IS_OPAC__: isOpac,
}),
],
externals: {
jquery: "jQuery",
"datatables.net": "DataTable",
"datatables.net-buttons": "DataTable",
"datatables.net-buttons/js/buttons.html5": "DataTable",
"datatables.net-buttons/js/buttons.print": "DataTable",
"datatables.net-buttons/js/buttons.colVis": "DataTable",
},
});
module.exports = [
// Staff interface ESM config
{
...createBaseConfig(false),
experiments: {
outputModule: true,
},
entry: {
islands: "./koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts",
},
output: {
filename: "[name].esm.js",
path: path.resolve(
__dirname,
"koha-tmpl/intranet-tmpl/prog/js/vue/dist/"
),
chunkFilename: "[name].[contenthash].esm.js",
globalObject: "window",
library: {
type: "module",
},
},
},
// OPAC interface config
{
...createBaseConfig(true),
experiments: {
outputModule: true,
},
entry: {
islands: "./koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts",
},
output: {
filename: "[name].esm.js",
path: path.resolve(
__dirname,
"koha-tmpl/opac-tmpl/bootstrap/js/vue/dist/"
),
chunkFilename: "[name].[contenthash].esm.js",
globalObject: "window",
library: {
type: "module",
},
},
},
];