hof 23.0.0-vite-sourcemap-beta → 23.0.2-vite-sourcemap-beta

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.
package/README.md CHANGED
@@ -78,7 +78,7 @@ You can change sourcemaps' default settings in hof.settings or your build config
78
78
  },
79
79
  "js": {
80
80
  "sourceMaps": true
81
- },
81
+ }
82
82
  }
83
83
  ```
84
84
  ## Watch
@@ -1,13 +1,17 @@
1
1
  'use strict';
2
2
 
3
- const vite = require('vite');
3
+ const fs = require('fs');
4
4
  const path = require('path');
5
+ const vite = require('vite');
5
6
  const viteConfig = path.resolve(__dirname, './vite.config.js');
6
7
  const hofDefaults = require('../../../config/hof-defaults');
7
8
 
8
9
  module.exports = config => {
9
10
  process.env.NODE_ENV = hofDefaults.env;
10
-
11
+ fs.writeFileSync(
12
+ path.resolve(__dirname, './hof-vite-config.json'),
13
+ JSON.stringify(config, null, 2)
14
+ );
11
15
  if(!config.production) {
12
16
  return vite.build({
13
17
  configFile: viteConfig,
@@ -6,9 +6,19 @@ import { resolve } from 'path';
6
6
  import fs from 'fs';
7
7
  import { nodeResolve } from '@rollup/plugin-node-resolve';
8
8
  import commonjs from '@rollup/plugin-commonjs';
9
- import config from '../../../config/builder-defaults';
9
+ // import hofDefaults from '../../../config/hof-defaults';
10
+
11
+ let tempConfig = {};
12
+ try {
13
+ tempConfig = JSON.parse(
14
+ fs.readFileSync(resolve(__dirname, './hof-vite-config.json'), 'utf8')
15
+ );
16
+ }catch (e) {
17
+ console.warn('Could not load hof-vite-config.json. ' + e.message);
18
+ }
10
19
 
11
20
  const publicDirectory = resolve(process.cwd(), 'public');
21
+ // const config = require('../../../config/builder-defaults.js');
12
22
  const entryFile = (() => {
13
23
  const src = resolve(process.cwd(), 'assets/js/index.js');
14
24
  if (fs.existsSync(src)) return src;
@@ -16,7 +26,7 @@ const entryFile = (() => {
16
26
  throw new Error(`vite: entry file not found. Checked: ${src}`);
17
27
  })();
18
28
 
19
-
29
+ console.log('5555555555 Vite build -in vite.config.js file :', tempConfig);
20
30
  export default defineConfig({
21
31
  plugins: [
22
32
  commonjs({
@@ -46,6 +56,20 @@ export default defineConfig({
46
56
  originalWarning(...args);
47
57
  };
48
58
  }
59
+ },
60
+ {
61
+ name: 'delete-hof-vite-config',
62
+ closeBundle() {
63
+ const configPath = resolve(__dirname, './hof-vite-config.json');
64
+ if (fs.existsSync(configPath)) {
65
+ try {
66
+ fs.unlinkSync(configPath);
67
+ console.log('.hof-vite-config.json deleted after build');
68
+ } catch (err) {
69
+ console.warn('Failed to delete .hof-vite-config.json:', err);
70
+ }
71
+ }
72
+ }
49
73
  }
50
74
  ],
51
75
  base: '/assets/',
@@ -53,7 +77,7 @@ export default defineConfig({
53
77
  build: {
54
78
  outDir: publicDirectory,
55
79
  emptyOutDir: false,
56
- sourcemap: config.js.sourceMaps, // Enable JS/TS sourcemaps in dev
80
+ sourcemap: tempConfig.js && tempConfig.js.sourceMaps,
57
81
  rollupOptions: {
58
82
  input: {
59
83
  index: entryFile
@@ -71,7 +95,6 @@ export default defineConfig({
71
95
  }
72
96
  },
73
97
  css: {
74
- // devSourcemap: isDev,
75
98
  preprocessorOptions: {
76
99
  scss: {
77
100
  includes: ['node_modules']
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "23.0.0-vite-sourcemap-beta",
4
+ "version": "23.0.2-vite-sourcemap-beta",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -11705,6 +11705,4 @@ fieldset + .reveal {
11705
11705
 
11706
11706
  .twitter-typeahead {
11707
11707
  width: 100%;
11708
- }
11709
-
11710
- /*# sourceMappingURL=app.css.map */
11708
+ }