@genesislcap/vite-builder 14.397.0 → 14.397.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAc3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;yBAEmB,KAAK,YAAY;AAAvC,wBAuJE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAc3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;yBAEmB,KAAK,YAAY;AAAvC,wBAkKE"}
package/dist/index.js CHANGED
@@ -35,8 +35,18 @@ exports.default = (ctx) => tslib_1.__awaiter(void 0, void 0, void 0, function* (
35
35
  const define = (0, build_kit_1.resolveDefineConfig)(env, http, 'vite');
36
36
  const handlebars = yield (0, vite_js_1.getHandlebarsModule)();
37
37
  const vite = yield (0, vite_js_1.getViteModule)();
38
+ const publicPath = (0, build_kit_1.getPublicPath)();
39
+ const baseHrefPlugin = {
40
+ name: 'genesis-base-href',
41
+ transformIndexHtml(html) {
42
+ if (html.includes('<base'))
43
+ return html;
44
+ return html.replace('<head>', `<head>\n <base href="${publicPath}" />`);
45
+ },
46
+ };
38
47
  const config = {
39
48
  plugins: [
49
+ baseHrefPlugin,
40
50
  handlebars({
41
51
  context: {
42
52
  // Template is shared with Webpack HTML plugin, which expects the data structure below
@@ -129,7 +139,7 @@ exports.default = (ctx) => tslib_1.__awaiter(void 0, void 0, void 0, function* (
129
139
  */
130
140
  include: ['@genesis-community/golden-layout'],
131
141
  },
132
- base: (0, build_kit_1.getPublicPath)(),
142
+ base: publicPath,
133
143
  };
134
144
  if (!(0, node_fs_1.existsSync)((0, node_path_1.resolve)(cwd, 'index.html'))) {
135
145
  consola_1.default.warn('index.html file not found - copying default one.');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/vite-builder",
3
3
  "description": "Vite builder",
4
- "version": "14.397.0",
4
+ "version": "14.397.1",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "lint:fix": "genx lint --fix"
17
17
  },
18
18
  "dependencies": {
19
- "@genesislcap/build-kit": "14.397.0",
19
+ "@genesislcap/build-kit": "14.397.1",
20
20
  "consola": "^3.0.2",
21
21
  "copyfiles": "^2.4.1",
22
22
  "vite": "^7.2.2",
@@ -30,5 +30,5 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "gitHead": "8f1ca152926bc3dfadd9f09ff5f712d0dafda2af"
33
+ "gitHead": "ee61ef9d0c4aec43e3c5b680141cb5b0db7c367a"
34
34
  }
package/src/index.ts CHANGED
@@ -61,8 +61,19 @@ export default async (ctx: BuildContext) => {
61
61
  const handlebars = await getHandlebarsModule();
62
62
  const vite = await getViteModule();
63
63
 
64
+ const publicPath = getPublicPath();
65
+
66
+ const baseHrefPlugin: Plugin = {
67
+ name: 'genesis-base-href',
68
+ transformIndexHtml(html) {
69
+ if (html.includes('<base')) return html;
70
+ return html.replace('<head>', `<head>\n <base href="${publicPath}" />`);
71
+ },
72
+ };
73
+
64
74
  const config: UserConfig = {
65
75
  plugins: [
76
+ baseHrefPlugin,
66
77
  handlebars({
67
78
  context: {
68
79
  // Template is shared with Webpack HTML plugin, which expects the data structure below
@@ -159,7 +170,7 @@ export default async (ctx: BuildContext) => {
159
170
  */
160
171
  include: ['@genesis-community/golden-layout'],
161
172
  },
162
- base: getPublicPath(),
173
+ base: publicPath,
163
174
  };
164
175
 
165
176
  if (!existsSync(resolve(cwd, 'index.html'))) {