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