@razerspine/webpack-core 1.1.7 → 1.2.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.
- package/CHANGELOG.md +24 -0
- package/README.md +59 -32
- package/dist/config/dev.d.ts +1 -1
- package/dist/config/dev.js +16 -17
- package/dist/config/prod.d.ts +1 -1
- package/dist/config/prod.js +4 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,29 @@ required to ensure correct behavior in both development and production modes.
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
## [1.2.1] - 2026-02-12
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **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 functionality.
|
|
16
|
+
- Integrated `webpack-merge` into `createDevConfig` for safer property merging.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Updated internal documentation and clarified version history in `CHANGELOG.md`.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## [1.2.0] - 2026-02-12
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- **Enhanced File Watching:** Updated `createDevConfig` to watch all files recursively in the `src/` directory (`src/**/*`). This ensures `webpack-dev-server` reacts to changes in any file type (images, JSON, new assets) without manual configuration.
|
|
27
|
+
- **Improved Dev Routing:** Configured `historyApiFallback` in development mode.
|
|
28
|
+
- 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 error pages and SPA-like navigation.
|
|
30
|
+
- **DevServer Optimization:** Set `hot: false` and `liveReload: true` as a stable default for multi-page template builds to ensure consistent page refreshes upon file changes.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
11
34
|
## [1.1.7] - 2026-02-11
|
|
12
35
|
|
|
13
36
|
### Changed
|
|
@@ -17,6 +40,7 @@ required to ensure correct behavior in both development and production modes.
|
|
|
17
40
|
### Stable Release Note
|
|
18
41
|
- **Important:** Versions prior to 1.1.6 were part of a stabilization phase and are not recommended for production use. This release marks the stable baseline.
|
|
19
42
|
|
|
43
|
+
---
|
|
20
44
|
|
|
21
45
|
## [1.1.6] - 2026-02-05
|
|
22
46
|
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Versions prior to 1.1.6 were part of a stabilization phase and are not recommend
|
|
|
13
13
|
|
|
14
14
|
Please use:
|
|
15
15
|
```bash
|
|
16
|
-
npm install @razerspine/webpack-core@^1.1
|
|
16
|
+
npm install @razerspine/webpack-core@^1.2.1
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Designed for
|
|
@@ -28,35 +28,22 @@ templates, but can also be used independently.
|
|
|
28
28
|
|
|
29
29
|
## Design principles
|
|
30
30
|
|
|
31
|
-
- Webpack is responsible for
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- Loaders and plugins:
|
|
37
|
-
- do not define aliases
|
|
38
|
-
- do not depend on UI kits
|
|
39
|
-
- do not assume project structure
|
|
40
|
-
|
|
41
|
-
- `pug-plugin` is used only to compile templates
|
|
42
|
-
Asset paths are resolved by webpack.
|
|
43
|
-
|
|
44
|
-
- Webpack JS entry is intentionally disabled
|
|
45
|
-
Builds are driven by template entries.
|
|
46
|
-
|
|
47
|
-
- No aggressive production optimizations by default
|
|
48
|
-
(e.g. no `splitChunks`)
|
|
31
|
+
- **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` argument.
|
|
33
|
+
- **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 `src/views/pages`.
|
|
35
|
+
- **Sensible Defaults**: No aggressive production optimizations (like `splitChunks`) are enabled by default to prevent asset resolution issues in templates.
|
|
49
36
|
|
|
50
37
|
---
|
|
51
38
|
|
|
52
39
|
## Features
|
|
53
40
|
|
|
54
|
-
- Pug templates support
|
|
55
|
-
- JavaScript / TypeScript
|
|
56
|
-
- SCSS / Less
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
41
|
+
- **Pug templates support** with auto-discovery.
|
|
42
|
+
- **JavaScript / TypeScript** integration.
|
|
43
|
+
- **SCSS / Less** styling support.
|
|
44
|
+
- **Recursive File Watching**: Dev server watches all changes in src/**/*.
|
|
45
|
+
- **SPA-friendly Dev Server**: Integrated historyApiFallback (redirects to 404.html).
|
|
46
|
+
- **Customizable**: Easily override devServer or optimization settings.
|
|
60
47
|
|
|
61
48
|
---
|
|
62
49
|
|
|
@@ -70,6 +57,8 @@ npm install @razerspine/webpack-core
|
|
|
70
57
|
|
|
71
58
|
## Usage
|
|
72
59
|
|
|
60
|
+
### Basic Setup
|
|
61
|
+
|
|
73
62
|
```js
|
|
74
63
|
const path = require('path');
|
|
75
64
|
const {
|
|
@@ -83,8 +72,8 @@ module.exports = (env = {}, argv = {}) => {
|
|
|
83
72
|
|
|
84
73
|
const baseConfig = createBaseConfig({
|
|
85
74
|
mode,
|
|
86
|
-
scripts: 'js',
|
|
87
|
-
styles: 'less'
|
|
75
|
+
scripts: 'js', // or 'ts'
|
|
76
|
+
styles: 'scss', // or 'less'
|
|
88
77
|
templates: {
|
|
89
78
|
entry: 'src/views/pages',
|
|
90
79
|
},
|
|
@@ -92,19 +81,57 @@ module.exports = (env = {}, argv = {}) => {
|
|
|
92
81
|
alias: {
|
|
93
82
|
'@views': path.resolve(process.cwd(), 'src/views'),
|
|
94
83
|
'@styles': path.resolve(process.cwd(), 'src/assets/styles'),
|
|
95
|
-
'@scripts': path.resolve(process.cwd(), 'src/assets/scripts'),
|
|
96
|
-
'@images': path.resolve(process.cwd(), 'src/assets/images'),
|
|
97
84
|
},
|
|
98
85
|
},
|
|
99
86
|
});
|
|
100
87
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
88
|
+
if (mode === 'development') {
|
|
89
|
+
return createDevConfig(baseConfig);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return createProdConfig(baseConfig);
|
|
104
93
|
};
|
|
105
94
|
```
|
|
106
95
|
|
|
96
|
+
### Customizing Configuration (v1.2.1+)
|
|
97
|
+
|
|
98
|
+
You can now pass an optional second argument to `createDevConfig` and `createProdConfig` to override defaults:
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
// Customizing the Dev Server (port, open browser, etc.)
|
|
102
|
+
if (mode === 'development') {
|
|
103
|
+
return createDevConfig(baseConfig, {
|
|
104
|
+
port: 3000,
|
|
105
|
+
open: true,
|
|
106
|
+
// extra devServer options...
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Customizing Production (minification, performance hints, etc.)
|
|
111
|
+
if (mode === 'production') {
|
|
112
|
+
return createProdConfig(baseConfig, {
|
|
113
|
+
performance: {
|
|
114
|
+
hints: 'warning',
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
107
120
|
---
|
|
108
121
|
|
|
122
|
+
## API Reference
|
|
123
|
+
|
|
124
|
+
`createDevConfig(baseConfig, options?)`
|
|
125
|
+
|
|
126
|
+
- `baseConfig`: The configuration returned by createBaseConfig.
|
|
127
|
+
- `options`: (Optional) webpack-dev-server configuration object.
|
|
128
|
+
- **Default behavior**: Watches `src/**/*`, uses port `8080`, and rewrites 404s to `/404.html`.
|
|
129
|
+
|
|
130
|
+
`createProdConfig(baseConfig, options?)`
|
|
131
|
+
|
|
132
|
+
- `baseConfig`: The configuration returned by createBaseConfig.
|
|
133
|
+
- `options`: (Optional) Webpack configuration object for production overrides.
|
|
134
|
+
- **Default behavior**: Enables source maps, minification, and disables `splitChunks` for template compatibility.
|
|
135
|
+
|
|
109
136
|
## 📄 License
|
|
110
137
|
This project is licensed under the ISC License.
|
package/dist/config/dev.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import type { Configuration as DevServerConfiguration } from 'webpack-dev-server
|
|
|
3
3
|
type DevConfig = WebpackConfiguration & {
|
|
4
4
|
devServer?: DevServerConfiguration;
|
|
5
5
|
};
|
|
6
|
-
export declare function createDevConfig(baseConfig: WebpackConfiguration): DevConfig;
|
|
6
|
+
export declare function createDevConfig(baseConfig: WebpackConfiguration, options?: DevServerConfiguration): DevConfig;
|
|
7
7
|
export {};
|
package/dist/config/dev.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createDevConfig = createDevConfig;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
hot: true,
|
|
17
|
-
open: true,
|
|
18
|
-
compress: true,
|
|
19
|
-
port: 8080,
|
|
20
|
-
},
|
|
4
|
+
const webpack_merge_1 = require("webpack-merge");
|
|
5
|
+
function createDevConfig(baseConfig, options = {}) {
|
|
6
|
+
const defaultDevServer = {
|
|
7
|
+
hot: false,
|
|
8
|
+
liveReload: true,
|
|
9
|
+
compress: true,
|
|
10
|
+
port: 8080,
|
|
11
|
+
watchFiles: ['src/**/*'],
|
|
12
|
+
historyApiFallback: {
|
|
13
|
+
disableDotRule: true,
|
|
14
|
+
rewrites: [{ from: /./, to: '/404.html' }]
|
|
15
|
+
}
|
|
21
16
|
};
|
|
17
|
+
return (0, webpack_merge_1.merge)(baseConfig, {
|
|
18
|
+
devtool: 'source-map',
|
|
19
|
+
devServer: (0, webpack_merge_1.merge)(defaultDevServer, options)
|
|
20
|
+
});
|
|
22
21
|
}
|
package/dist/config/prod.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Configuration } from 'webpack';
|
|
2
|
-
export declare function createProdConfig(baseConfig: Configuration): Configuration;
|
|
2
|
+
export declare function createProdConfig(baseConfig: Configuration, options?: Configuration): Configuration;
|
package/dist/config/prod.js
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createProdConfig = createProdConfig;
|
|
4
4
|
const webpack_merge_1 = require("webpack-merge");
|
|
5
|
-
function createProdConfig(baseConfig) {
|
|
6
|
-
|
|
5
|
+
function createProdConfig(baseConfig, options = {}) {
|
|
6
|
+
const defaultConfig = {
|
|
7
7
|
devtool: 'source-map',
|
|
8
8
|
optimization: {
|
|
9
9
|
minimize: true,
|
|
10
|
-
// ⚠️ splitChunks deliberately disabled
|
|
11
|
-
// pug-plugin manages assets & entries itself
|
|
12
10
|
splitChunks: false,
|
|
13
11
|
runtimeChunk: false,
|
|
14
12
|
},
|
|
15
13
|
performance: {
|
|
16
14
|
hints: false,
|
|
17
15
|
},
|
|
18
|
-
}
|
|
16
|
+
};
|
|
17
|
+
return (0, webpack_merge_1.merge)(baseConfig, defaultConfig, options);
|
|
19
18
|
}
|