@enhanced-dom/webpack 0.0.4 → 0.0.7
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/configs/index.d.ts +19 -0
- package/configs/index.js +30 -0
- package/{config.d.ts → index.d.ts} +2 -0
- package/{config.js → index.js} +8 -2
- package/loaders/ExposeCssSourceLoader.js +8 -4
- package/loaders/index.d.ts +7 -4
- package/loaders/index.js +8 -10
- package/package.json +73 -81
- package/plugins/HtmlWebpackInlineSourcePlugin.js +2 -2
- package/plugins/index.d.ts +6 -5
- package/plugins/index.js +5 -5
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import IgnoreEmitWebpackPlugin from 'ignore-emit-webpack-plugin';
|
|
2
|
+
export declare const typedStylesConfigFactory: ({ raw, filesPaths }: {
|
|
3
|
+
raw?: boolean;
|
|
4
|
+
filesPaths: string[];
|
|
5
|
+
}) => {
|
|
6
|
+
mode: string;
|
|
7
|
+
entry: {
|
|
8
|
+
bundle: string[];
|
|
9
|
+
};
|
|
10
|
+
devtool: boolean;
|
|
11
|
+
watch: boolean;
|
|
12
|
+
module: {
|
|
13
|
+
rules: {
|
|
14
|
+
test: RegExp;
|
|
15
|
+
use: any[];
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
plugins: IgnoreEmitWebpackPlugin[];
|
|
19
|
+
};
|
package/configs/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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.typedStylesConfigFactory = void 0;
|
|
7
|
+
const ignore_emit_webpack_plugin_1 = __importDefault(require("ignore-emit-webpack-plugin"));
|
|
8
|
+
const loaders_1 = require("../loaders");
|
|
9
|
+
const typedStylesConfigFactory = ({ raw, filesPaths }) => {
|
|
10
|
+
return {
|
|
11
|
+
mode: 'production',
|
|
12
|
+
entry: { bundle: filesPaths },
|
|
13
|
+
devtool: false,
|
|
14
|
+
watch: true,
|
|
15
|
+
module: {
|
|
16
|
+
rules: [
|
|
17
|
+
{
|
|
18
|
+
test: /\.(pcss|css)$/,
|
|
19
|
+
use: (0, loaders_1.styleConfigFactory)({ raw, typedStyles: true, parser: 'postcss', modules: true }),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
test: /\.(scss|sass)$/,
|
|
23
|
+
use: (0, loaders_1.styleConfigFactory)({ raw, typedStyles: true, parser: 'postcss-scss', modules: true }),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
plugins: [new ignore_emit_webpack_plugin_1.default(/.+/)],
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.typedStylesConfigFactory = typedStylesConfigFactory;
|
package/{config.js → index.js}
RENAMED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -20,7 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
24
|
};
|
|
21
25
|
const loaders = __importStar(require("./loaders"));
|
|
22
26
|
const plugins = __importStar(require("./plugins"));
|
|
27
|
+
const configs = __importStar(require("./configs"));
|
|
23
28
|
module.exports = {
|
|
24
29
|
loaders,
|
|
25
|
-
plugins
|
|
30
|
+
plugins,
|
|
31
|
+
configs,
|
|
26
32
|
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const style_loader_1 = __importDefault(require("style-loader"));
|
|
6
|
+
const lodash_1 = require("lodash");
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2
8
|
const loader = function () { };
|
|
3
|
-
const styleLoader = require('style-loader');
|
|
4
|
-
const uniqueId = require('lodash').uniqueId;
|
|
5
9
|
loader.pitch = function pitch(remainingRequest) {
|
|
6
10
|
if (this.cacheable) {
|
|
7
11
|
this.cacheable();
|
|
8
12
|
}
|
|
9
|
-
const result =
|
|
13
|
+
const result = style_loader_1.default.pitch.call(this, remainingRequest);
|
|
10
14
|
const index = result.indexOf('var update = API(content, options)');
|
|
11
15
|
if (index <= -1)
|
|
12
16
|
return result;
|
|
13
17
|
const insertIndex = index - 1;
|
|
14
|
-
const stylesheetName = uniqueId('stylesheet-');
|
|
18
|
+
const stylesheetName = (0, lodash_1.uniqueId)('stylesheet-');
|
|
15
19
|
const insertAttr = `
|
|
16
20
|
options.attributes = options.attributes || {}
|
|
17
21
|
options.attributes.title = "${stylesheetName}";
|
package/loaders/index.d.ts
CHANGED
|
@@ -4,12 +4,15 @@ export declare const styleConfigFactory: ({ raw, extract, sourceMap, typedStyles
|
|
|
4
4
|
sourceMap?: boolean;
|
|
5
5
|
typedStyles?: boolean;
|
|
6
6
|
modules?: {
|
|
7
|
-
localIdentName
|
|
8
|
-
mappings
|
|
7
|
+
localIdentName?: string;
|
|
8
|
+
mappings?: {
|
|
9
9
|
filter: string;
|
|
10
10
|
transform: (p: string) => string;
|
|
11
11
|
}[];
|
|
12
|
-
}
|
|
12
|
+
} | (boolean & {
|
|
13
|
+
localIdentName?: never;
|
|
14
|
+
mappings?: never;
|
|
15
|
+
});
|
|
13
16
|
parser?: "postcss" | "postcss-scss";
|
|
14
17
|
aliases?: Record<string, string>;
|
|
15
18
|
}) => any[];
|
|
@@ -29,7 +32,7 @@ export declare const babelConfigFactory: ({ babel }: {
|
|
|
29
32
|
loader: string;
|
|
30
33
|
options: any;
|
|
31
34
|
}[];
|
|
32
|
-
export declare const markdownConfigFactory: ({ babel, remark
|
|
35
|
+
export declare const markdownConfigFactory: ({ babel, remark }?: {
|
|
33
36
|
babel?: any;
|
|
34
37
|
remark?: any[];
|
|
35
38
|
}) => any[];
|
package/loaders/index.js
CHANGED
|
@@ -7,11 +7,8 @@ exports.markdownConfigFactory = exports.babelConfigFactory = exports.assetExtens
|
|
|
7
7
|
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
8
8
|
const postcss_import_webpack_resolver_1 = __importDefault(require("postcss-import-webpack-resolver"));
|
|
9
9
|
const ExposeCssSourceLoader = require.resolve('./ExposeCssSourceLoader');
|
|
10
|
-
// @ts-ignore
|
|
11
10
|
const remark_code_import_1 = __importDefault(require("remark-code-import"));
|
|
12
|
-
// @ts-ignore
|
|
13
11
|
const remark_unwrap_images_1 = __importDefault(require("remark-unwrap-images"));
|
|
14
|
-
// @ts-ignore
|
|
15
12
|
const remark_embed_images_1 = __importDefault(require("remark-embed-images"));
|
|
16
13
|
const styleConfigFactory = ({ raw = false, extract = false, sourceMap = false, typedStyles = false, modules = undefined, parser = undefined, aliases = {}, } = {}) => {
|
|
17
14
|
var _a;
|
|
@@ -20,8 +17,8 @@ const styleConfigFactory = ({ raw = false, extract = false, sourceMap = false, t
|
|
|
20
17
|
loaders.push({
|
|
21
18
|
loader: ExposeCssSourceLoader,
|
|
22
19
|
options: {
|
|
23
|
-
attributes: {}
|
|
24
|
-
}
|
|
20
|
+
attributes: {},
|
|
21
|
+
},
|
|
25
22
|
});
|
|
26
23
|
}
|
|
27
24
|
else if (extract) {
|
|
@@ -29,7 +26,7 @@ const styleConfigFactory = ({ raw = false, extract = false, sourceMap = false, t
|
|
|
29
26
|
loader: mini_css_extract_plugin_1.default.loader,
|
|
30
27
|
options: {
|
|
31
28
|
publicPath: './',
|
|
32
|
-
}
|
|
29
|
+
},
|
|
33
30
|
});
|
|
34
31
|
}
|
|
35
32
|
else {
|
|
@@ -54,8 +51,9 @@ const styleConfigFactory = ({ raw = false, extract = false, sourceMap = false, t
|
|
|
54
51
|
modules: {
|
|
55
52
|
localIdentName: (_a = modules === null || modules === void 0 ? void 0 : modules.localIdentName) !== null && _a !== void 0 ? _a : '[local]_[hash:base64:5]',
|
|
56
53
|
getLocalIdent: (loaderContext, _, localName) => {
|
|
54
|
+
var _a;
|
|
57
55
|
const { resourcePath } = loaderContext;
|
|
58
|
-
const
|
|
56
|
+
const mappings = (_a = modules === null || modules === void 0 ? void 0 : modules.mappings) !== null && _a !== void 0 ? _a : [];
|
|
59
57
|
const mapping = mappings.find(({ filter }) => resourcePath.includes(filter));
|
|
60
58
|
if (!mapping) {
|
|
61
59
|
return undefined; // this will trigger the default css-loader getLocalIdent function
|
|
@@ -85,7 +83,7 @@ const styleConfigFactory = ({ raw = false, extract = false, sourceMap = false, t
|
|
|
85
83
|
[
|
|
86
84
|
'postcss-import',
|
|
87
85
|
{
|
|
88
|
-
resolve: postcss_import_webpack_resolver_1.default({
|
|
86
|
+
resolve: (0, postcss_import_webpack_resolver_1.default)({
|
|
89
87
|
alias: aliases,
|
|
90
88
|
}),
|
|
91
89
|
modules: ['./node_modules', 'node_modules'],
|
|
@@ -122,10 +120,10 @@ const babelConfigFactory = ({ babel = undefined }) => {
|
|
|
122
120
|
return loaders;
|
|
123
121
|
};
|
|
124
122
|
exports.babelConfigFactory = babelConfigFactory;
|
|
125
|
-
const markdownConfigFactory = ({ babel, remark = []
|
|
123
|
+
const markdownConfigFactory = ({ babel, remark = [] } = {}) => {
|
|
126
124
|
const loaders = [];
|
|
127
125
|
if (babel) {
|
|
128
|
-
loaders.push(...exports.babelConfigFactory({ babel }));
|
|
126
|
+
loaders.push(...(0, exports.babelConfigFactory)({ babel }));
|
|
129
127
|
loaders.push({
|
|
130
128
|
loader: '@mdx-js/loader',
|
|
131
129
|
options: {
|
package/package.json
CHANGED
|
@@ -1,81 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@enhanced-dom/webpack",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Helpers for webpack configuration",
|
|
5
|
-
"keywords": [],
|
|
6
|
-
"repository": "https://github.com/enhanced-dom/webpack.git",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
|
|
9
|
-
"main": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"postcss": "^
|
|
35
|
-
"postcss-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
"webpack-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"@
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"autoprefixer": "^10.3.5",
|
|
75
|
-
"webpack": "^5.28.0"
|
|
76
|
-
},
|
|
77
|
-
"engines": {
|
|
78
|
-
"node": ">=14.17.0",
|
|
79
|
-
"npm": ">=8.0.0"
|
|
80
|
-
}
|
|
81
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@enhanced-dom/webpack",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"description": "Helpers for webpack configuration",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"repository": "https://github.com/enhanced-dom/webpack.git",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
|
|
9
|
+
"main": "index.js",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@enhanced-dom/build": "^0.0.1",
|
|
12
|
+
"@mdx-js/loader": "^2.1.1",
|
|
13
|
+
"autoprefixer": "^10.3.5",
|
|
14
|
+
"babel-loader": "^8.2.2",
|
|
15
|
+
"css-loader": "^6.2.0",
|
|
16
|
+
"cssnano-preset-advanced": "^5.1.3",
|
|
17
|
+
"dts-css-modules-loader": "^1.2.3",
|
|
18
|
+
"html-inline-css-webpack-plugin": "^1.11.1",
|
|
19
|
+
"html-inline-script-webpack-plugin": "^2.0.3",
|
|
20
|
+
"html-loader": "^2.1.2",
|
|
21
|
+
"html-webpack-inline-source-plugin": "^0.0.10",
|
|
22
|
+
"html-webpack-plugin": "^5.3.1",
|
|
23
|
+
"ignore-emit-webpack-plugin": "^2.0.6",
|
|
24
|
+
"markdown-loader": "^8.0.0",
|
|
25
|
+
"mini-css-extract-plugin": "^2.3.0",
|
|
26
|
+
"null-loader": "^4.0.1",
|
|
27
|
+
"css-minimizer-webpack-plugin": "^3.0.2",
|
|
28
|
+
"postcss": "^8.2.15",
|
|
29
|
+
"postcss-import": "^14.0.2",
|
|
30
|
+
"postcss-import-webpack-resolver": "^1.0.1",
|
|
31
|
+
"postcss-loader": "^6.1.1",
|
|
32
|
+
"postcss-nested": "^5.0.6",
|
|
33
|
+
"postcss-preset-env": "^6.7.0",
|
|
34
|
+
"postcss-advanced-variables": "^3.0.1",
|
|
35
|
+
"postcss-scss": "^4.0.0",
|
|
36
|
+
"module-from-string": "^3.0.0",
|
|
37
|
+
"raw-loader": "^4.0.2",
|
|
38
|
+
"remark-code-import": "^0.3.0",
|
|
39
|
+
"remark-embed-images": "^2.0.0",
|
|
40
|
+
"remark-images": "^2.0.0",
|
|
41
|
+
"remark-unwrap-images": "^2.0.0",
|
|
42
|
+
"resolve-url-loader": "^4.0.0",
|
|
43
|
+
"source-map-loader": "^3.0.0",
|
|
44
|
+
"style-loader": "^3.2.1",
|
|
45
|
+
"terser-webpack-plugin": "^5.1.2",
|
|
46
|
+
"webpack": "^5.70.0",
|
|
47
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
|
48
|
+
"webpack-cli": "^4.9.2",
|
|
49
|
+
"webpack-dev-server": "^4.9.0",
|
|
50
|
+
"serve": "^12.0.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@enhanced-dom/lint": "^0.0.7",
|
|
54
|
+
"@types/html-webpack-plugin": "^3.2.5",
|
|
55
|
+
"@types/loader-utils": "^2.0.2",
|
|
56
|
+
"@types/mini-css-extract-plugin": "^1.4.3",
|
|
57
|
+
"@types/optimize-css-assets-webpack-plugin": "^5.0.3",
|
|
58
|
+
"@types/terser-webpack-plugin": "^5.2.0",
|
|
59
|
+
"@types/webpack": "^5.28.0",
|
|
60
|
+
"@types/webpack-bundle-analyzer": "^2.9.2",
|
|
61
|
+
"typescript": "^4.2.2"
|
|
62
|
+
},
|
|
63
|
+
"overrides": {
|
|
64
|
+
"postcss": "^8.2.15",
|
|
65
|
+
"postcss-scss": "^4.0.0",
|
|
66
|
+
"autoprefixer": "^10.3.5",
|
|
67
|
+
"terser": "^5.12.1"
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">=14.17.0",
|
|
71
|
+
"npm": ">=8.0.0"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-this-alias */
|
|
5
6
|
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
6
|
-
// @ts-ignore
|
|
7
7
|
const html_webpack_inline_source_plugin_1 = __importDefault(require("html-webpack-inline-source-plugin"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -31,7 +31,7 @@ html_webpack_inline_source_plugin_1.default.prototype.apply = function (compiler
|
|
|
31
31
|
if (!favicon || !fs_1.default.existsSync(favicon)) {
|
|
32
32
|
return callback(null, result);
|
|
33
33
|
}
|
|
34
|
-
const faviconTag = result.headTags.find(tag => tag.tagName === 'link' && tag.attributes.rel === 'icon');
|
|
34
|
+
const faviconTag = result.headTags.find((tag) => tag.tagName === 'link' && tag.attributes.rel === 'icon');
|
|
35
35
|
if (faviconTag) {
|
|
36
36
|
self.faviconPath = faviconTag.attributes.href;
|
|
37
37
|
faviconTag.attributes.href = `data:image/x-icon;base64, ${fs_1.default.readFileSync(favicon, 'base64')}`;
|
package/plugins/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
2
|
+
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
3
|
+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
2
4
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
3
5
|
import { MinifyOptions } from 'terser';
|
|
4
6
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
@@ -6,14 +8,13 @@ import { WebpackPluginInstance } from 'webpack';
|
|
|
6
8
|
export declare const cssConfigFactory: ({ filename, cssnanoOptions, }?: {
|
|
7
9
|
filename?: string;
|
|
8
10
|
cssnanoOptions?: any;
|
|
9
|
-
}) =>
|
|
11
|
+
}) => (MiniCssExtractPlugin | CssMinimizerPlugin<CssMinimizerPlugin.CssNanoOptionsExtended>)[];
|
|
10
12
|
export declare const bundleAnalyzerConfigFactory: (extraConfig?: BundleAnalyzerPlugin.Options) => BundleAnalyzerPlugin[];
|
|
11
|
-
export declare const htmlConfigFactory: ({ html, embed
|
|
13
|
+
export declare const htmlConfigFactory: ({ html, embed }?: {
|
|
12
14
|
embed?: boolean;
|
|
13
15
|
html?: Partial<HtmlWebpackPlugin.Options>;
|
|
14
|
-
outputPath?: string;
|
|
15
16
|
}) => WebpackPluginInstance[];
|
|
16
|
-
export declare const terserConfigFactory: ({ enableSourcemaps, terserOptions
|
|
17
|
+
export declare const terserConfigFactory: ({ enableSourcemaps, terserOptions }?: {
|
|
17
18
|
enableSourcemaps?: boolean;
|
|
18
19
|
terserOptions?: MinifyOptions;
|
|
19
|
-
}) => TerserPlugin[];
|
|
20
|
+
}) => TerserPlugin<MinifyOptions>[];
|
package/plugins/index.js
CHANGED
|
@@ -39,7 +39,7 @@ const bundleAnalyzerConfigFactory = (extraConfig = {}) => {
|
|
|
39
39
|
];
|
|
40
40
|
};
|
|
41
41
|
exports.bundleAnalyzerConfigFactory = bundleAnalyzerConfigFactory;
|
|
42
|
-
const htmlConfigFactory = ({ html = {}, embed
|
|
42
|
+
const htmlConfigFactory = ({ html = {}, embed } = {}) => {
|
|
43
43
|
var _a;
|
|
44
44
|
const template = (_a = html.template) !== null && _a !== void 0 ? _a : path_1.default.join(process.cwd(), 'template.html');
|
|
45
45
|
const templateExists = fs_1.default.existsSync(template);
|
|
@@ -59,7 +59,7 @@ const htmlConfigFactory = ({ html = {}, embed, outputPath = './dist' } = {}) =>
|
|
|
59
59
|
lang: 'en-US',
|
|
60
60
|
...(templateExists ? { template } : { templateContent }),
|
|
61
61
|
...html,
|
|
62
|
-
favicon
|
|
62
|
+
favicon,
|
|
63
63
|
}),
|
|
64
64
|
];
|
|
65
65
|
if (embed) {
|
|
@@ -68,13 +68,13 @@ const htmlConfigFactory = ({ html = {}, embed, outputPath = './dist' } = {}) =>
|
|
|
68
68
|
return plugins;
|
|
69
69
|
};
|
|
70
70
|
exports.htmlConfigFactory = htmlConfigFactory;
|
|
71
|
-
const terserConfigFactory = ({ enableSourcemaps = true, terserOptions = {}
|
|
71
|
+
const terserConfigFactory = ({ enableSourcemaps = true, terserOptions = {} } = {}) => [
|
|
72
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
72
73
|
new terser_webpack_plugin_1.default({
|
|
73
74
|
parallel: true,
|
|
74
|
-
cache: true,
|
|
75
|
-
sourceMap: enableSourcemaps,
|
|
76
75
|
terserOptions: {
|
|
77
76
|
ie8: false,
|
|
77
|
+
sourceMap: enableSourcemaps,
|
|
78
78
|
compress: {
|
|
79
79
|
evaluate: false,
|
|
80
80
|
},
|