@razerspine/webpack-core 1.2.1 → 1.2.3
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/CHANGELOG.md
CHANGED
|
@@ -8,14 +8,40 @@ required to ensure correct behavior in both development and production modes.
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
## [1.2.3] - 2026-02-17
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Validation Layer**: Introduced `validateCoreOptions()` inside `createBaseConfig`.
|
|
16
|
+
- Validates `mode`, `scripts`, and `styles` values.
|
|
17
|
+
- Ensures the templates entry directory exists before Webpack initialization.
|
|
18
|
+
- Prevents silent runtime failures in pug-plugin due to invalid configuration.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **Dev Server Default Behavior**: Enabled `open: true` in default `devServer` configuration.
|
|
23
|
+
- Development server now automatically opens the browser.
|
|
24
|
+
- Improves developer experience for starter templates.
|
|
25
|
+
|
|
26
|
+
### Notes
|
|
27
|
+
|
|
28
|
+
- This release does **not introduce breaking changes**.
|
|
29
|
+
- Public API remains unchanged.
|
|
30
|
+
- Existing templates continue to work without modification.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
11
34
|
## [1.2.1] - 2026-02-12
|
|
12
35
|
|
|
13
36
|
### Added
|
|
37
|
+
|
|
14
38
|
- **Flexible Configurations:** Added an optional `options` argument to both `createDevConfig` and `createProdConfig`.
|
|
15
|
-
- Users can now override default `devServer` settings or Webpack production optimizations without losing the base
|
|
39
|
+
- Users can now override default `devServer` settings or Webpack production optimizations without losing the base
|
|
40
|
+
functionality.
|
|
16
41
|
- Integrated `webpack-merge` into `createDevConfig` for safer property merging.
|
|
17
42
|
|
|
18
43
|
### Fixed
|
|
44
|
+
|
|
19
45
|
- Updated internal documentation and clarified version history in `CHANGELOG.md`.
|
|
20
46
|
|
|
21
47
|
---
|
|
@@ -23,28 +49,37 @@ required to ensure correct behavior in both development and production modes.
|
|
|
23
49
|
## [1.2.0] - 2026-02-12
|
|
24
50
|
|
|
25
51
|
### Changed
|
|
26
|
-
|
|
52
|
+
|
|
53
|
+
- **Enhanced File Watching:** Updated `createDevConfig` to watch all files recursively in the `src/` directory (
|
|
54
|
+
`src/**/*`). This ensures `webpack-dev-server` reacts to changes in any file type (images, JSON, new assets) without
|
|
55
|
+
manual configuration.
|
|
27
56
|
- **Improved Dev Routing:** Configured `historyApiFallback` in development mode.
|
|
28
57
|
- Set `disableDotRule: true` to allow dots in URLs (useful for complex routing).
|
|
29
|
-
- Added a global rewrite rule to serve `/404.html` for any non-existent paths, enabling better local testing of 404
|
|
30
|
-
|
|
58
|
+
- Added a global rewrite rule to serve `/404.html` for any non-existent paths, enabling better local testing of 404
|
|
59
|
+
error pages and SPA-like navigation.
|
|
60
|
+
- **DevServer Optimization:** Set `hot: false` and `liveReload: true` as a stable default for multi-page template builds
|
|
61
|
+
to ensure consistent page refreshes upon file changes.
|
|
31
62
|
|
|
32
63
|
---
|
|
33
64
|
|
|
34
65
|
## [1.1.7] - 2026-02-11
|
|
35
66
|
|
|
36
67
|
### Changed
|
|
68
|
+
|
|
37
69
|
- Updated `README.md`
|
|
38
70
|
- Updated `package.json` metadata (keywords, published files)
|
|
39
71
|
|
|
40
72
|
### Stable Release Note
|
|
41
|
-
|
|
73
|
+
|
|
74
|
+
- **Important:** Versions prior to 1.1.6 were part of a stabilization phase and are not recommended for production use.
|
|
75
|
+
This release marks the stable baseline.
|
|
42
76
|
|
|
43
77
|
---
|
|
44
78
|
|
|
45
79
|
## [1.1.6] - 2026-02-05
|
|
46
80
|
|
|
47
81
|
### Changed
|
|
82
|
+
|
|
48
83
|
- Updated `package.json` metadata (keywords, published files)
|
|
49
84
|
- Updated `README.md`
|
|
50
85
|
|
|
@@ -53,12 +88,14 @@ required to ensure correct behavior in both development and production modes.
|
|
|
53
88
|
## [1.1.5] - 2026-02-05
|
|
54
89
|
|
|
55
90
|
### Fixed
|
|
91
|
+
|
|
56
92
|
- Stabilized production webpack configuration for pug-plugin driven builds
|
|
57
93
|
- Disabled `splitChunks` and `runtimeChunk` to prevent asset resolution issues
|
|
58
94
|
- Ensured predictable output structure in production mode
|
|
59
95
|
- Reduced risk of entry-related build failures
|
|
60
96
|
|
|
61
97
|
### Notes
|
|
98
|
+
|
|
62
99
|
- This release finalizes the stabilization phase of the production configuration
|
|
63
100
|
- Recommended as a stable baseline for template usage
|
|
64
101
|
|
|
@@ -67,6 +104,7 @@ required to ensure correct behavior in both development and production modes.
|
|
|
67
104
|
## [1.1.4] - 2026-02-05
|
|
68
105
|
|
|
69
106
|
### Fixed
|
|
107
|
+
|
|
70
108
|
- Final stabilization of production configuration
|
|
71
109
|
- Ensured consistent build behavior for pug-plugin driven templates
|
|
72
110
|
|
|
@@ -75,6 +113,7 @@ required to ensure correct behavior in both development and production modes.
|
|
|
75
113
|
## [1.1.0 – 1.1.3] - 2026-02-05
|
|
76
114
|
|
|
77
115
|
### Fixed
|
|
116
|
+
|
|
78
117
|
- Multiple fixes for production configuration edge cases
|
|
79
118
|
- Improved compatibility between pug-plugin, assets loader, and webpack optimization
|
|
80
119
|
- Stabilized production builds for template-driven entry points
|
|
@@ -84,6 +123,7 @@ required to ensure correct behavior in both development and production modes.
|
|
|
84
123
|
## [1.0.9] - 2026-02-05
|
|
85
124
|
|
|
86
125
|
### Fixed
|
|
126
|
+
|
|
87
127
|
- Removed implicit webpack entry from production config
|
|
88
128
|
- Fixed production build failure caused by default webpack entry resolution
|
|
89
129
|
|
|
@@ -92,6 +132,7 @@ required to ensure correct behavior in both development and production modes.
|
|
|
92
132
|
## [1.0.8] - 2026-02-05
|
|
93
133
|
|
|
94
134
|
### Fixed
|
|
135
|
+
|
|
95
136
|
- Fixed `resolve.alias` handling across loaders and pug-plugin
|
|
96
137
|
|
|
97
138
|
---
|
|
@@ -99,6 +140,7 @@ required to ensure correct behavior in both development and production modes.
|
|
|
99
140
|
## [1.0.7] - 2026-02-05
|
|
100
141
|
|
|
101
142
|
### Fixed
|
|
143
|
+
|
|
102
144
|
- Fixed Pug asset resolution in production mode
|
|
103
145
|
- Passed webpack `resolve.alias` into pug-plugin resolver
|
|
104
146
|
- Ensured consistent alias behavior in development and production
|
|
@@ -108,6 +150,7 @@ required to ensure correct behavior in both development and production modes.
|
|
|
108
150
|
## [1.0.6] - 2026-02-05
|
|
109
151
|
|
|
110
152
|
### Fixed
|
|
153
|
+
|
|
111
154
|
- Fixed webpack plugin instance mismatch when used via `npm link`
|
|
112
155
|
- Moved `webpack-dev-server` and `pug-plugin` to `peerDependencies`
|
|
113
156
|
- Ensured a single webpack instance is used in consumer templates
|
|
@@ -117,6 +160,7 @@ required to ensure correct behavior in both development and production modes.
|
|
|
117
160
|
## [1.0.5] - 2026-02-04
|
|
118
161
|
|
|
119
162
|
### Fixed
|
|
163
|
+
|
|
120
164
|
- Explicitly disabled webpack default entry (`./src`)
|
|
121
165
|
- Ensured stable behavior when using pug-plugin as the primary entry system
|
|
122
166
|
|
|
@@ -125,6 +169,7 @@ required to ensure correct behavior in both development and production modes.
|
|
|
125
169
|
## [1.0.4] - 2026-02-04
|
|
126
170
|
|
|
127
171
|
### Fixed
|
|
172
|
+
|
|
128
173
|
- Fixed TypeScript typing for `webpack-dev-server`
|
|
129
174
|
- Properly extended webpack Configuration with devServer types
|
|
130
175
|
|
|
@@ -133,11 +178,13 @@ required to ensure correct behavior in both development and production modes.
|
|
|
133
178
|
## [1.0.3] - 2026-02-04
|
|
134
179
|
|
|
135
180
|
### Fixed
|
|
181
|
+
|
|
136
182
|
- Fixed webpack default entry fallback (`./src`)
|
|
137
183
|
- Prevented webpack from resolving non-existing JS entry when using pug-plugin
|
|
138
184
|
- Stabilized template entry handling via `templatesLoader`
|
|
139
185
|
|
|
140
186
|
### Internal
|
|
187
|
+
|
|
141
188
|
- Clarified responsibility between webpack entry and pug-plugin entry
|
|
142
189
|
|
|
143
190
|
---
|
|
@@ -145,9 +192,12 @@ required to ensure correct behavior in both development and production modes.
|
|
|
145
192
|
## [1.0.2] - 2026-02-04
|
|
146
193
|
|
|
147
194
|
### Fixed
|
|
195
|
+
|
|
148
196
|
- Fixed ENV mode option typing
|
|
149
197
|
- Stabilized base configuration behavior
|
|
150
198
|
|
|
151
199
|
## [Unreleased]
|
|
200
|
+
|
|
152
201
|
### Changed
|
|
202
|
+
|
|
153
203
|
- Updated README.md
|
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ template-driven builds using `pug-plugin`.
|
|
|
12
12
|
Versions prior to 1.1.6 were part of a stabilization phase and are not recommended for production use.
|
|
13
13
|
|
|
14
14
|
Please use:
|
|
15
|
+
|
|
15
16
|
```bash
|
|
16
17
|
npm install @razerspine/webpack-core@^1.2.1
|
|
17
18
|
```
|
|
@@ -29,10 +30,15 @@ templates, but can also be used independently.
|
|
|
29
30
|
## Design principles
|
|
30
31
|
|
|
31
32
|
- **Webpack is responsible for**: module resolution, aliases (`resolve.alias`), and asset handling.
|
|
32
|
-
- **Flexibility:** Since v1.2.1, you can override any part of the dev or prod configuration using an optional `options`
|
|
33
|
+
- **Flexibility:** Since v1.2.1, you can override any part of the dev or prod configuration using an optional `options`
|
|
34
|
+
argument.
|
|
33
35
|
- **Stability:** `pug-plugin` is used to compile templates, and asset paths are resolved by webpack.
|
|
34
|
-
- **Template-driven**: Webpack JS entry is intentionally disabled. Builds are driven by template entries in
|
|
35
|
-
|
|
36
|
+
- **Template-driven**: Webpack JS entry is intentionally disabled. Builds are driven by template entries in
|
|
37
|
+
`src/views/pages`.
|
|
38
|
+
- **Sensible Defaults**: No aggressive production optimizations (like `splitChunks`) are enabled by default to prevent
|
|
39
|
+
asset resolution issues in templates.
|
|
40
|
+
- **Validated configuration layer (v1.2.2+)**: Core options are validated before build initialization to prevent silent
|
|
41
|
+
runtime failures.
|
|
36
42
|
|
|
37
43
|
---
|
|
38
44
|
|
|
@@ -41,9 +47,22 @@ templates, but can also be used independently.
|
|
|
41
47
|
- **Pug templates support** with auto-discovery.
|
|
42
48
|
- **JavaScript / TypeScript** integration.
|
|
43
49
|
- **SCSS / Less** styling support.
|
|
44
|
-
- **Recursive File Watching**: Dev server watches all changes in src
|
|
50
|
+
- **Recursive File Watching**: Dev server watches all changes in `src/**/*`.
|
|
45
51
|
- **SPA-friendly Dev Server**: Integrated historyApiFallback (redirects to 404.html).
|
|
46
52
|
- **Customizable**: Easily override devServer or optimization settings.
|
|
53
|
+
- **Configuration validation layer**
|
|
54
|
+
- **Automatic browser open in development (v1.2.2+)**
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## What’s New in v1.2.2
|
|
59
|
+
|
|
60
|
+
- Added `validateCoreOptions()` inside `createBaseConfig`
|
|
61
|
+
- Validates `mode`, `scripts`, and `styles`
|
|
62
|
+
- Ensures templates entry directory exists before Webpack starts
|
|
63
|
+
- Dev server now opens the browser automatically (`open: true` by default)
|
|
64
|
+
|
|
65
|
+
> No breaking changes were introduced.
|
|
47
66
|
|
|
48
67
|
---
|
|
49
68
|
|
|
@@ -111,7 +130,7 @@ if (mode === 'development') {
|
|
|
111
130
|
if (mode === 'production') {
|
|
112
131
|
return createProdConfig(baseConfig, {
|
|
113
132
|
performance: {
|
|
114
|
-
|
|
133
|
+
hints: 'warning',
|
|
115
134
|
}
|
|
116
135
|
});
|
|
117
136
|
}
|
|
@@ -121,12 +140,30 @@ if (mode === 'production') {
|
|
|
121
140
|
|
|
122
141
|
## API Reference
|
|
123
142
|
|
|
143
|
+
`createBaseConfig(options)`
|
|
144
|
+
|
|
145
|
+
Core configuration factory.
|
|
146
|
+
|
|
147
|
+
**Options include**:
|
|
148
|
+
|
|
149
|
+
- `mode` — `'development' | 'production'`
|
|
150
|
+
- `scripts` — `'js' | 'ts'`
|
|
151
|
+
- `styles` — `'scss' | 'less'`
|
|
152
|
+
- `templates.entry` — Path to template pages directory
|
|
153
|
+
- `resolve.alias` — Webpack aliases
|
|
154
|
+
|
|
155
|
+
All options are validated before initialization.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
124
159
|
`createDevConfig(baseConfig, options?)`
|
|
125
160
|
|
|
126
161
|
- `baseConfig`: The configuration returned by createBaseConfig.
|
|
127
162
|
- `options`: (Optional) webpack-dev-server configuration object.
|
|
128
163
|
- **Default behavior**: Watches `src/**/*`, uses port `8080`, and rewrites 404s to `/404.html`.
|
|
129
164
|
|
|
165
|
+
---
|
|
166
|
+
|
|
130
167
|
`createProdConfig(baseConfig, options?)`
|
|
131
168
|
|
|
132
169
|
- `baseConfig`: The configuration returned by createBaseConfig.
|
|
@@ -134,4 +171,5 @@ if (mode === 'production') {
|
|
|
134
171
|
- **Default behavior**: Enables source maps, minification, and disables `splitChunks` for template compatibility.
|
|
135
172
|
|
|
136
173
|
## 📄 License
|
|
174
|
+
|
|
137
175
|
This project is licensed under the ISC License.
|
package/dist/config/base.js
CHANGED
|
@@ -9,8 +9,10 @@ const scripts_1 = require("../loaders/scripts");
|
|
|
9
9
|
const styles_1 = require("../loaders/styles");
|
|
10
10
|
const templates_1 = require("../loaders/templates");
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const validate_core_options_1 = require("../validation/validate-core-options");
|
|
12
13
|
function createBaseConfig(options) {
|
|
13
14
|
var _a, _b, _c, _d;
|
|
15
|
+
(0, validate_core_options_1.validateCoreOptions)(options);
|
|
14
16
|
const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : 'development';
|
|
15
17
|
return {
|
|
16
18
|
mode,
|
package/dist/config/dev.js
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateCoreOptions = validateCoreOptions;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
function validateCoreOptions(options) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
if (!options) {
|
|
12
|
+
throw new Error('[webpack-core] Options are required.');
|
|
13
|
+
}
|
|
14
|
+
const { mode, scripts, styles } = options;
|
|
15
|
+
// --- mode
|
|
16
|
+
if (!['development', 'production'].includes(mode)) {
|
|
17
|
+
throw new Error(`[webpack-core] Invalid mode "${mode}". Expected "development" or "production".`);
|
|
18
|
+
}
|
|
19
|
+
// --- scripts
|
|
20
|
+
if (!['js', 'ts'].includes(scripts)) {
|
|
21
|
+
throw new Error(`[webpack-core] Invalid scripts option "${scripts}". Expected "js" or "ts".`);
|
|
22
|
+
}
|
|
23
|
+
// --- styles
|
|
24
|
+
if (!['scss', 'less'].includes(styles)) {
|
|
25
|
+
throw new Error(`[webpack-core] Invalid styles option "${styles}". Expected "scss" or "less".`);
|
|
26
|
+
}
|
|
27
|
+
// --- templates entry
|
|
28
|
+
const entryRelative = (_b = (_a = options.templates) === null || _a === void 0 ? void 0 : _a.entry) !== null && _b !== void 0 ? _b : 'src/views/pages';
|
|
29
|
+
const entryAbsolute = path_1.default.resolve(process.cwd(), entryRelative);
|
|
30
|
+
if (!fs_1.default.existsSync(entryAbsolute)) {
|
|
31
|
+
throw new Error(`[webpack-core] Templates entry directory does not exist: ${entryAbsolute}`);
|
|
32
|
+
}
|
|
33
|
+
}
|