@razerspine/webpack-core 1.0.2 → 1.0.4
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/dist/config/base.d.ts +6 -1
- package/dist/config/base.js +12 -7
- package/dist/config/dev.d.ts +6 -3
- package/dist/config/dev.js +16 -3
- package/dist/loaders/scripts.js +4 -4
- package/dist/loaders/templates.js +4 -4
- package/package.json +3 -3
package/dist/config/base.d.ts
CHANGED
|
@@ -2,7 +2,12 @@ import { ModeType } from '../types/mode-type';
|
|
|
2
2
|
import { ConfigOptionType } from '../types/config-option-type';
|
|
3
3
|
export declare function createBaseConfig(options: ConfigOptionType): {
|
|
4
4
|
mode: ModeType;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* IMPORTANT:
|
|
7
|
+
* Explicit empty entry to prevent webpack default './src'
|
|
8
|
+
* PugPlugin controls entry points
|
|
9
|
+
*/
|
|
10
|
+
entry: {};
|
|
6
11
|
output: {
|
|
7
12
|
clean: boolean;
|
|
8
13
|
};
|
package/dist/config/base.js
CHANGED
|
@@ -10,7 +10,12 @@ function createBaseConfig(options) {
|
|
|
10
10
|
const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : 'development';
|
|
11
11
|
return {
|
|
12
12
|
mode,
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* IMPORTANT:
|
|
15
|
+
* Explicit empty entry to prevent webpack default './src'
|
|
16
|
+
* PugPlugin controls entry points
|
|
17
|
+
*/
|
|
18
|
+
entry: {},
|
|
14
19
|
output: {
|
|
15
20
|
clean: true,
|
|
16
21
|
},
|
|
@@ -18,17 +23,17 @@ function createBaseConfig(options) {
|
|
|
18
23
|
rules: [
|
|
19
24
|
(0, assets_1.assetsLoader)(),
|
|
20
25
|
(0, scripts_1.scriptsLoader)(options),
|
|
21
|
-
(0, styles_1.stylesLoader)(options)
|
|
22
|
-
]
|
|
26
|
+
(0, styles_1.stylesLoader)(options),
|
|
27
|
+
],
|
|
23
28
|
},
|
|
24
29
|
plugins: [
|
|
25
30
|
...(0, templates_1.templatesLoader)({
|
|
26
31
|
entry: (_b = options.templates) === null || _b === void 0 ? void 0 : _b.entry,
|
|
27
|
-
mode
|
|
28
|
-
})
|
|
32
|
+
mode,
|
|
33
|
+
}),
|
|
29
34
|
],
|
|
30
35
|
resolve: {
|
|
31
|
-
extensions: ['.ts', '.tsx', '.js', '.json']
|
|
32
|
-
}
|
|
36
|
+
extensions: ['.ts', '.tsx', '.js', '.json'],
|
|
37
|
+
},
|
|
33
38
|
};
|
|
34
39
|
}
|
package/dist/config/dev.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Configuration as WebpackConfiguration } from 'webpack';
|
|
2
|
+
import type { Configuration as DevServerConfiguration } from 'webpack-dev-server';
|
|
3
|
+
type DevConfig = WebpackConfiguration & {
|
|
4
|
+
devServer?: DevServerConfiguration;
|
|
4
5
|
};
|
|
6
|
+
export declare function createDevConfig(baseConfig: WebpackConfiguration): DevConfig;
|
|
7
|
+
export {};
|
package/dist/config/dev.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createDevConfig = createDevConfig;
|
|
4
|
-
function createDevConfig() {
|
|
4
|
+
function createDevConfig(baseConfig) {
|
|
5
5
|
return {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
...baseConfig,
|
|
7
|
+
/**
|
|
8
|
+
* Prevent webpack-dev-server from injecting ./src entry
|
|
9
|
+
*/
|
|
10
|
+
entry: () => ({}),
|
|
11
|
+
devtool: 'eval-source-map',
|
|
12
|
+
devServer: {
|
|
13
|
+
static: {
|
|
14
|
+
directory: 'public',
|
|
15
|
+
},
|
|
16
|
+
hot: true,
|
|
17
|
+
open: true,
|
|
18
|
+
compress: true,
|
|
19
|
+
port: 8080,
|
|
20
|
+
},
|
|
8
21
|
};
|
|
9
22
|
}
|
package/dist/loaders/scripts.js
CHANGED
|
@@ -9,14 +9,14 @@ function scriptsLoader(env) {
|
|
|
9
9
|
use: {
|
|
10
10
|
loader: 'ts-loader',
|
|
11
11
|
options: {
|
|
12
|
-
transpileOnly: env.mode === 'development'
|
|
13
|
-
}
|
|
14
|
-
}
|
|
12
|
+
transpileOnly: env.mode === 'development',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
return {
|
|
18
18
|
test: /\.m?js$/,
|
|
19
19
|
exclude: /node_modules/,
|
|
20
|
-
use: 'babel-loader'
|
|
20
|
+
use: 'babel-loader',
|
|
21
21
|
};
|
|
22
22
|
}
|
|
@@ -19,13 +19,13 @@ function templatesLoader(options) {
|
|
|
19
19
|
js: {
|
|
20
20
|
filename: options.mode === 'production'
|
|
21
21
|
? 'js/[name].[contenthash:8].js'
|
|
22
|
-
: 'js/[name].js'
|
|
22
|
+
: 'js/[name].js',
|
|
23
23
|
},
|
|
24
24
|
css: {
|
|
25
25
|
filename: options.mode === 'production'
|
|
26
26
|
? 'css/[name].[contenthash:8].css'
|
|
27
|
-
: 'css/[name].css'
|
|
28
|
-
}
|
|
29
|
-
})
|
|
27
|
+
: 'css/[name].css',
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
30
|
];
|
|
31
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razerspine/webpack-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Core webpack config and loaders for starter templates",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Razerspine",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"pug-plugin": "^5.0.3"
|
|
22
22
|
},
|
|
23
|
-
|
|
24
23
|
"devDependencies": {
|
|
25
24
|
"@types/node": "^20.11.0",
|
|
26
|
-
"typescript": "^5.3.3"
|
|
25
|
+
"typescript": "^5.3.3",
|
|
26
|
+
"webpack-dev-server": "^5.2.3"
|
|
27
27
|
}
|
|
28
28
|
}
|