@studyportals/webpack-helper 5.1.0 → 5.2.0-bf605c6b.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/package.json CHANGED
@@ -1,65 +1,66 @@
1
- {
2
- "name": "@studyportals/webpack-helper",
3
- "version": "5.1.0",
4
- "description": "A collection of standard configurations and helpers for webpack.",
5
- "main": "src/main.js",
6
- "scripts": {
7
- "test": "jest --coverage",
8
- "build": "tsc",
9
- "prepublish": "npm run build",
10
- "postinstall": "cp ./assets/.babelrc ./assets/.browserslistrc ../../../"
11
- },
12
- "files": [
13
- "src/**/*.js",
14
- "assets/*"
15
- ],
16
- "author": {
17
- "name": "Frank Kluijtmans",
18
- "email": "frank@studyportals.com"
19
- },
20
- "license": "ISC",
21
- "dependencies": {
22
- "@babel/core": "^7.5.5",
23
- "@babel/plugin-proposal-class-properties": "^7.13.0",
24
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
25
- "@babel/plugin-transform-modules-commonjs": "^7.5.0",
26
- "@babel/plugin-transform-runtime": "^7.5.5",
27
- "@babel/plugin-transform-typescript": "^7.5.5",
28
- "@babel/preset-env": "^7.5.5",
29
- "@babel/preset-typescript": "^7.3.3",
30
- "@babel/runtime": "^7.5.5",
31
- "@studyportals/bob-manifest-generator": "5.0.0",
32
- "@studyportals/browserslist-config": "^1.2.0",
33
- "@studyportals/dll-availability-tracker": "^2.0.0",
34
- "@studyportals/vue-config": "^5.0.2",
35
- "@types/jest": "^27.0.0",
36
- "@vue/cli-plugin-babel": "^5.0.4",
37
- "@vue/cli-plugin-unit-jest": "^5.0.4",
38
- "@vue/test-utils": "^2.0.2",
39
- "@vue/vue3-jest": "^27.0.0",
40
- "babel-jest": "^27.5.1",
41
- "babel-loader": "^8.2.3",
42
- "css-loader": "^6.5.1",
43
- "file-loader": "^6.2.0",
44
- "mini-css-extract-plugin": "^2.5.3",
45
- "css-minimizer-webpack-plugin": "^4.0.0",
46
- "jest": "^27.0.0",
47
- "jest-junit": "^13.0.0",
48
- "jest-serializer-vue": "^2.0.2",
49
- "path": "^0.12.7",
50
- "sass": "^1.49.7",
51
- "sass-loader": "^12.4.0",
52
- "terser-webpack-plugin": "^5.3.1",
53
- "ts-jest": "^27.0.0",
54
- "ts-loader": "^9.2.6",
55
- "typescript": "^4.7.4",
56
- "vue-loader": "^16.2.0",
57
- "webpack": "^5.76.0",
58
- "webpack-cli": "^4.9.1",
59
- "webpack-merge": "^5.8.0"
60
- },
61
- "devDependencies": {
62
- "@types/jest": "^27.4.0",
63
- "@types/node": "^17.0.14"
64
- }
65
- }
1
+ {
2
+ "name": "@studyportals/webpack-helper",
3
+ "version": "5.2.0-bf605c6b.0",
4
+ "description": "A collection of standard configurations and helpers for webpack.",
5
+ "main": "src/main.js",
6
+ "scripts": {
7
+ "test": "jest --coverage",
8
+ "build": "tsc",
9
+ "prepublish": "npm run build",
10
+ "postinstall": "cp ./assets/.babelrc ./assets/.browserslistrc ../../../"
11
+ },
12
+ "files": [
13
+ "src/**/*.js",
14
+ "assets/*"
15
+ ],
16
+ "author": {
17
+ "name": "Frank Kluijtmans",
18
+ "email": "frank@studyportals.com"
19
+ },
20
+ "license": "ISC",
21
+ "dependencies": {
22
+ "@babel/core": "^7.5.5",
23
+ "@babel/plugin-proposal-class-properties": "^7.13.0",
24
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
25
+ "@babel/plugin-transform-modules-commonjs": "^7.5.0",
26
+ "@babel/plugin-transform-runtime": "^7.5.5",
27
+ "@babel/plugin-transform-typescript": "^7.5.5",
28
+ "@babel/preset-env": "^7.5.5",
29
+ "@babel/preset-typescript": "^7.3.3",
30
+ "@babel/runtime": "^7.5.5",
31
+ "@studyportals/bob-manifest-generator": "5.0.1",
32
+ "@studyportals/browserslist-config": "^1.2.0",
33
+ "@studyportals/dll-availability-tracker": "^2.0.0",
34
+ "@studyportals/vue-config": "^5.0.2",
35
+ "@types/jest": "^27.0.0",
36
+ "@vue/cli-plugin-babel": "^5.0.4",
37
+ "@vue/cli-plugin-unit-jest": "^5.0.4",
38
+ "@vue/test-utils": "^2.0.2",
39
+ "@vue/vue3-jest": "^27.0.0",
40
+ "babel-jest": "^27.5.1",
41
+ "babel-loader": "^8.2.3",
42
+ "css-loader": "^6.5.1",
43
+ "css-minimizer-webpack-plugin": "^4.0.0",
44
+ "file-loader": "^6.2.0",
45
+ "jest": "^27.0.0",
46
+ "jest-junit": "^13.0.0",
47
+ "jest-serializer-vue": "^2.0.2",
48
+ "mini-css-extract-plugin": "^2.5.3",
49
+ "path": "^0.12.7",
50
+ "sass": "^1.49.7",
51
+ "sass-loader": "^12.4.0",
52
+ "terser-webpack-plugin": "^5.3.1",
53
+ "ts-jest": "^27.0.0",
54
+ "ts-loader": "^9.2.6",
55
+ "typescript": "^4.7.4",
56
+ "vue-loader": "^16.2.0",
57
+ "webpack": "^5.76.0",
58
+ "webpack-cli": "^4.9.1",
59
+ "webpack-merge": "^5.8.0"
60
+ },
61
+ "devDependencies": {
62
+ "@types/jest": "^27.4.0",
63
+ "@types/node": "^17.0.14",
64
+ "fork-ts-checker-webpack-plugin": "^8.0.0"
65
+ }
66
+ }
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DevelopmentConfig = void 0;
4
- exports.DevelopmentConfig = {
5
- optimization: {
6
- minimize: false
7
- }
8
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DevelopmentConfig = void 0;
4
+ exports.DevelopmentConfig = {
5
+ optimization: {
6
+ minimize: false
7
+ }
8
+ };
@@ -1,62 +1,62 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductionConfig = void 0;
4
- const webpack = require('webpack');
5
- const cssMinimizerPlugin = require('css-minimizer-webpack-plugin');
6
- const DllAvailabilityTracker = require('@studyportals/dll-availability-tracker');
7
- const ProductionConfig = (bobConfig) => {
8
- let dllDependencies = ['library'];
9
- if (bobConfig && bobConfig.hasOwnProperty('dllPackages')) {
10
- bobConfig.dllPackages.forEach((dependency) => dllDependencies.push(dependency.manifest.name));
11
- }
12
- return {
13
- plugins: [
14
- new webpack.LoaderOptionsPlugin({
15
- minimize: true
16
- }),
17
- new webpack.DefinePlugin({
18
- 'process.env': {
19
- NODE_ENV: '"production"'
20
- }
21
- }),
22
- new cssMinimizerPlugin({
23
- minimizerOptions: {
24
- preset: [
25
- 'default',
26
- {
27
- discardComments: {
28
- removeAll: true
29
- }
30
- }
31
- ]
32
- },
33
- }),
34
- new DllAvailabilityTracker({
35
- dependencies: dllDependencies || []
36
- })
37
- ],
38
- optimization: {
39
- minimize: true,
40
- minimizer: [
41
- compiler => {
42
- const TerserPlugin = require('terser-webpack-plugin');
43
- new TerserPlugin({
44
- parallel: true,
45
- extractComments: false,
46
- terserOptions: {
47
- output: {
48
- comments: false
49
- },
50
- compress: {
51
- drop_console: true,
52
- passes: 5
53
- },
54
- sourceMap: true
55
- }
56
- }).apply(compiler);
57
- }
58
- ]
59
- }
60
- };
61
- };
62
- exports.ProductionConfig = ProductionConfig;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductionConfig = void 0;
4
+ const webpack = require('webpack');
5
+ const cssMinimizerPlugin = require('css-minimizer-webpack-plugin');
6
+ const DllAvailabilityTracker = require('@studyportals/dll-availability-tracker');
7
+ const ProductionConfig = (bobConfig) => {
8
+ let dllDependencies = ['library'];
9
+ if (bobConfig && bobConfig.hasOwnProperty('dllPackages')) {
10
+ bobConfig.dllPackages.forEach((dependency) => dllDependencies.push(dependency.manifest.name));
11
+ }
12
+ return {
13
+ plugins: [
14
+ new webpack.LoaderOptionsPlugin({
15
+ minimize: true
16
+ }),
17
+ new webpack.DefinePlugin({
18
+ 'process.env': {
19
+ NODE_ENV: '"production"'
20
+ }
21
+ }),
22
+ new cssMinimizerPlugin({
23
+ minimizerOptions: {
24
+ preset: [
25
+ 'default',
26
+ {
27
+ discardComments: {
28
+ removeAll: true
29
+ }
30
+ }
31
+ ]
32
+ },
33
+ }),
34
+ new DllAvailabilityTracker({
35
+ dependencies: dllDependencies || []
36
+ })
37
+ ],
38
+ optimization: {
39
+ minimize: true,
40
+ minimizer: [
41
+ compiler => {
42
+ const TerserPlugin = require('terser-webpack-plugin');
43
+ new TerserPlugin({
44
+ parallel: true,
45
+ extractComments: false,
46
+ terserOptions: {
47
+ output: {
48
+ comments: false
49
+ },
50
+ compress: {
51
+ drop_console: true,
52
+ passes: 5
53
+ },
54
+ sourceMap: true
55
+ }
56
+ }).apply(compiler);
57
+ }
58
+ ]
59
+ }
60
+ };
61
+ };
62
+ exports.ProductionConfig = ProductionConfig;
package/src/enums/mode.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mode = void 0;
4
- var Mode;
5
- (function (Mode) {
6
- Mode["DEVELOPMENT"] = "development";
7
- Mode["PRODUCTION"] = "production";
8
- })(Mode = exports.Mode || (exports.Mode = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Mode = void 0;
4
+ var Mode;
5
+ (function (Mode) {
6
+ Mode["DEVELOPMENT"] = "development";
7
+ Mode["PRODUCTION"] = "production";
8
+ })(Mode = exports.Mode || (exports.Mode = {}));
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Preset = void 0;
4
- var Preset;
5
- (function (Preset) {
6
- Preset["VUE_TYPESCRIPT"] = "vue-typescript";
7
- Preset["TYPESCRIPT"] = "typescript";
8
- Preset["JAVASCRIPT"] = "javascript";
9
- Preset["VUE_TYPESCRIPT_NO_CODE_SPLITTING"] = "vue-typescript-no-code-splitting";
10
- })(Preset = exports.Preset || (exports.Preset = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Preset = void 0;
4
+ var Preset;
5
+ (function (Preset) {
6
+ Preset["VUE_TYPESCRIPT"] = "vue-typescript";
7
+ Preset["TYPESCRIPT"] = "typescript";
8
+ Preset["JAVASCRIPT"] = "javascript";
9
+ Preset["VUE_TYPESCRIPT_NO_CODE_SPLITTING"] = "vue-typescript-no-code-splitting";
10
+ })(Preset = exports.Preset || (exports.Preset = {}));
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigurationFactory = void 0;
4
- const configuration_1 = require("../model/configuration");
5
- class ConfigurationFactory {
6
- create(options) {
7
- return new configuration_1.Configuration(options);
8
- }
9
- }
10
- exports.ConfigurationFactory = ConfigurationFactory;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfigurationFactory = void 0;
4
+ const configuration_1 = require("../model/configuration");
5
+ class ConfigurationFactory {
6
+ create(options) {
7
+ return new configuration_1.Configuration(options);
8
+ }
9
+ }
10
+ exports.ConfigurationFactory = ConfigurationFactory;
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/src/main.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const configuration_factory_1 = require("./factories/configuration-factory");
4
- const configurationFactory = new configuration_factory_1.ConfigurationFactory();
5
- module.exports = configurationFactory;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const configuration_factory_1 = require("./factories/configuration-factory");
4
+ const configurationFactory = new configuration_factory_1.ConfigurationFactory();
5
+ module.exports = configurationFactory;
@@ -1,125 +1,125 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Configuration = void 0;
4
- const entry_1 = require("./entry");
5
- const output_1 = require("./output");
6
- const plugins_1 = require("./plugins");
7
- const module_1 = require("./module");
8
- const preset_1 = require("../enums/preset");
9
- const vue_typescript_preset_1 = require("../presets/vue-typescript.preset");
10
- const typescript_preset_1 = require("../presets/typescript.preset");
11
- const javascript_preset_1 = require("../presets/javascript.preset");
12
- const vue_typescript_no_code_splitting_preset_1 = require("../presets/vue-typescript-no-code-splitting.preset");
13
- const mode_1 = require("../enums/mode");
14
- const production_config_1 = require("../defaults/production.config");
15
- const development_config_1 = require("../defaults/development.config");
16
- const ManifestGenerator = require("@studyportals/bob-manifest-generator").ManifestGenerator;
17
- const DllReferencePlugin = require("@studyportals/bob-manifest-generator").DllReferencePlugin;
18
- const { merge } = require('webpack-merge');
19
- class Configuration {
20
- constructor(options) {
21
- this.bob = options.bob || null;
22
- this.entry = new entry_1.Entry(options.entry);
23
- this.output = new output_1.Output(options.output);
24
- this.extensions = options.extensions || [];
25
- this.preset = options.preset || null;
26
- this.hash = options.output.hash || false;
27
- this.plugins = new plugins_1.Plugins(options.plugins);
28
- this.module = new module_1.Module(options.module);
29
- this.commonConfig = options.common || {};
30
- const configDev = options[mode_1.Mode.DEVELOPMENT] ? options[mode_1.Mode.DEVELOPMENT] : {};
31
- const configPrd = options[mode_1.Mode.PRODUCTION] ? options[mode_1.Mode.PRODUCTION] : {};
32
- this.environmentSpecificConfig = {
33
- [mode_1.Mode.DEVELOPMENT]: merge([configDev, development_config_1.DevelopmentConfig]) || development_config_1.DevelopmentConfig,
34
- [mode_1.Mode.PRODUCTION]: merge([configPrd, (0, production_config_1.ProductionConfig)(this.bob)]) || (0, production_config_1.ProductionConfig)(this.bob)
35
- };
36
- this.fileName = options.output.fileName || "[name]";
37
- }
38
- get(mode) {
39
- this.detectPresets(mode);
40
- return merge({
41
- entry: this.entry.getEntry(),
42
- output: this.output.getOutput(),
43
- plugins: this.plugins.getPlugins(),
44
- module: this.module.getModule(),
45
- resolve: {
46
- extensions: this.extensions
47
- },
48
- performance: {
49
- hints: false
50
- },
51
- optimization: {
52
- minimize: false
53
- },
54
- devtool: 'source-map'
55
- }, this.getBobConfig(), this.commonConfig, this.getEnvironmentSpecificConfig(mode), { mode });
56
- }
57
- detectPresets(mode) {
58
- switch (this.preset) {
59
- case preset_1.Preset.VUE_TYPESCRIPT:
60
- this.injectPreset(new vue_typescript_preset_1.VueTypeScriptPreset(mode));
61
- break;
62
- case preset_1.Preset.TYPESCRIPT:
63
- this.injectPreset(new typescript_preset_1.TypeScriptPreset());
64
- break;
65
- case preset_1.Preset.JAVASCRIPT:
66
- this.injectPreset(new javascript_preset_1.JavascriptPreset());
67
- break;
68
- case preset_1.Preset.VUE_TYPESCRIPT_NO_CODE_SPLITTING:
69
- this.injectPreset(new vue_typescript_no_code_splitting_preset_1.VueTypescriptNoCodeSplittingPreset(mode));
70
- break;
71
- default:
72
- break;
73
- }
74
- }
75
- injectPreset(preset) {
76
- const plugins = preset.getPlugins(this.getCSSFileName());
77
- const module = preset.getModule();
78
- plugins.forEach(plugin => {
79
- this.plugins.addPlugin(plugin);
80
- });
81
- this.extensions = this.extensions.concat(preset.getExtensions());
82
- this.module.setModule(module);
83
- }
84
- getEnvironmentSpecificConfig(mode) {
85
- return this.environmentSpecificConfig[mode];
86
- }
87
- getBobConfig() {
88
- if (this.bob === null) {
89
- return {};
90
- }
91
- let dllPackages = [];
92
- if (typeof this.bob.dllPackages !== 'undefined'
93
- && this.bob.dllPackages.length > 0) {
94
- dllPackages = this.getBobDllDependencies();
95
- delete this.bob.dllPackages;
96
- }
97
- return {
98
- plugins: [
99
- new ManifestGenerator(this.bob)
100
- ].concat(dllPackages)
101
- };
102
- }
103
- getBobDllDependencies() {
104
- let dependencies = [];
105
- if (typeof this.bob.dllPackages === 'undefined')
106
- return dependencies;
107
- this.bob.dllPackages.forEach((dependency) => {
108
- dependencies.push(new DllReferencePlugin({
109
- name: dependency.name,
110
- manifest: dependency.manifest
111
- }));
112
- });
113
- return dependencies;
114
- }
115
- getCSSFileName() {
116
- const fileName = this.fileName || `style`;
117
- if (this.hash === false
118
- || typeof this.hash.css !== 'undefined'
119
- && this.hash.css === false) {
120
- return `${fileName}.css`;
121
- }
122
- return `${fileName}.[fullhash].css`;
123
- }
124
- }
125
- exports.Configuration = Configuration;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Configuration = void 0;
4
+ const entry_1 = require("./entry");
5
+ const output_1 = require("./output");
6
+ const plugins_1 = require("./plugins");
7
+ const module_1 = require("./module");
8
+ const preset_1 = require("../enums/preset");
9
+ const vue_typescript_preset_1 = require("../presets/vue-typescript.preset");
10
+ const typescript_preset_1 = require("../presets/typescript.preset");
11
+ const javascript_preset_1 = require("../presets/javascript.preset");
12
+ const vue_typescript_no_code_splitting_preset_1 = require("../presets/vue-typescript-no-code-splitting.preset");
13
+ const mode_1 = require("../enums/mode");
14
+ const production_config_1 = require("../defaults/production.config");
15
+ const development_config_1 = require("../defaults/development.config");
16
+ const ManifestGenerator = require("@studyportals/bob-manifest-generator").ManifestGenerator;
17
+ const DllReferencePlugin = require("@studyportals/bob-manifest-generator").DllReferencePlugin;
18
+ const { merge } = require('webpack-merge');
19
+ class Configuration {
20
+ constructor(options) {
21
+ this.bob = options.bob || null;
22
+ this.entry = new entry_1.Entry(options.entry);
23
+ this.output = new output_1.Output(options.output);
24
+ this.extensions = options.extensions || [];
25
+ this.preset = options.preset || null;
26
+ this.hash = options.output.hash || false;
27
+ this.plugins = new plugins_1.Plugins(options.plugins);
28
+ this.module = new module_1.Module(options.module);
29
+ this.commonConfig = options.common || {};
30
+ const configDev = options[mode_1.Mode.DEVELOPMENT] ? options[mode_1.Mode.DEVELOPMENT] : {};
31
+ const configPrd = options[mode_1.Mode.PRODUCTION] ? options[mode_1.Mode.PRODUCTION] : {};
32
+ this.environmentSpecificConfig = {
33
+ [mode_1.Mode.DEVELOPMENT]: merge([configDev, development_config_1.DevelopmentConfig]) || development_config_1.DevelopmentConfig,
34
+ [mode_1.Mode.PRODUCTION]: merge([configPrd, (0, production_config_1.ProductionConfig)(this.bob)]) || (0, production_config_1.ProductionConfig)(this.bob)
35
+ };
36
+ this.fileName = options.output.fileName || "[name]";
37
+ }
38
+ get(mode) {
39
+ this.detectPresets(mode);
40
+ return merge({
41
+ entry: this.entry.getEntry(),
42
+ output: this.output.getOutput(),
43
+ plugins: this.plugins.getPlugins(),
44
+ module: this.module.getModule(),
45
+ resolve: {
46
+ extensions: this.extensions
47
+ },
48
+ performance: {
49
+ hints: false
50
+ },
51
+ optimization: {
52
+ minimize: false
53
+ },
54
+ devtool: 'source-map'
55
+ }, this.getBobConfig(), this.commonConfig, this.getEnvironmentSpecificConfig(mode), { mode });
56
+ }
57
+ detectPresets(mode) {
58
+ switch (this.preset) {
59
+ case preset_1.Preset.VUE_TYPESCRIPT:
60
+ this.injectPreset(new vue_typescript_preset_1.VueTypeScriptPreset(mode));
61
+ break;
62
+ case preset_1.Preset.TYPESCRIPT:
63
+ this.injectPreset(new typescript_preset_1.TypeScriptPreset());
64
+ break;
65
+ case preset_1.Preset.JAVASCRIPT:
66
+ this.injectPreset(new javascript_preset_1.JavascriptPreset());
67
+ break;
68
+ case preset_1.Preset.VUE_TYPESCRIPT_NO_CODE_SPLITTING:
69
+ this.injectPreset(new vue_typescript_no_code_splitting_preset_1.VueTypescriptNoCodeSplittingPreset(mode));
70
+ break;
71
+ default:
72
+ break;
73
+ }
74
+ }
75
+ injectPreset(preset) {
76
+ const plugins = preset.getPlugins(this.getCSSFileName());
77
+ const module = preset.getModule();
78
+ plugins.forEach(plugin => {
79
+ this.plugins.addPlugin(plugin);
80
+ });
81
+ this.extensions = this.extensions.concat(preset.getExtensions());
82
+ this.module.setModule(module);
83
+ }
84
+ getEnvironmentSpecificConfig(mode) {
85
+ return this.environmentSpecificConfig[mode];
86
+ }
87
+ getBobConfig() {
88
+ if (this.bob === null) {
89
+ return {};
90
+ }
91
+ let dllPackages = [];
92
+ if (typeof this.bob.dllPackages !== 'undefined'
93
+ && this.bob.dllPackages.length > 0) {
94
+ dllPackages = this.getBobDllDependencies();
95
+ delete this.bob.dllPackages;
96
+ }
97
+ return {
98
+ plugins: [
99
+ new ManifestGenerator(this.bob)
100
+ ].concat(dllPackages)
101
+ };
102
+ }
103
+ getBobDllDependencies() {
104
+ let dependencies = [];
105
+ if (typeof this.bob.dllPackages === 'undefined')
106
+ return dependencies;
107
+ this.bob.dllPackages.forEach((dependency) => {
108
+ dependencies.push(new DllReferencePlugin({
109
+ name: dependency.name,
110
+ manifest: dependency.manifest
111
+ }));
112
+ });
113
+ return dependencies;
114
+ }
115
+ getCSSFileName() {
116
+ const fileName = this.fileName || `style`;
117
+ if (this.hash === false
118
+ || typeof this.hash.css !== 'undefined'
119
+ && this.hash.css === false) {
120
+ return `${fileName}.css`;
121
+ }
122
+ return `${fileName}.[fullhash].css`;
123
+ }
124
+ }
125
+ exports.Configuration = Configuration;