@studyportals/webpack-helper 4.0.0-0 → 4.0.0-2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/webpack-helper",
3
- "version": "4.0.0-0",
3
+ "version": "4.0.0-2",
4
4
  "description": "A collection of standard configurations and helpers for webpack.",
5
5
  "main": "src/main.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  "@studyportals/bob-manifest-generator": "^3.0.0",
32
32
  "@studyportals/browserslist-config": "^1.2.0",
33
33
  "@studyportals/dll-availability-tracker": "^2.0.0",
34
- "@studyportals/vue-config": "^4.1.3-1",
34
+ "@studyportals/vue-config": "^5.0.0-0",
35
35
  "@types/jest": "^27.0.0",
36
36
  "@vue/cli-plugin-babel": "^5.0.4",
37
37
  "@vue/cli-plugin-unit-jest": "^5.0.4",
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductionConfig = void 0;
4
4
  const webpack = require('webpack');
5
- const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
5
+ const cssMinimizerPlugin = require('css-minimizer-webpack-plugin');
6
6
  const DllAvailabilityTracker = require('@studyportals/dll-availability-tracker');
7
- exports.ProductionConfig = (bobConfig) => {
7
+ const ProductionConfig = (bobConfig) => {
8
8
  let dllDependencies = ['library'];
9
9
  if (bobConfig && bobConfig.hasOwnProperty('dllPackages')) {
10
10
  bobConfig.dllPackages.forEach((dependency) => dllDependencies.push(dependency.manifest.name));
@@ -19,8 +19,8 @@ exports.ProductionConfig = (bobConfig) => {
19
19
  NODE_ENV: '"production"'
20
20
  }
21
21
  }),
22
- new OptimizeCSSAssetsPlugin({
23
- cssProcessorPluginOptions: {
22
+ new cssMinimizerPlugin({
23
+ minimizerOptions: {
24
24
  preset: [
25
25
  'default',
26
26
  {
@@ -59,3 +59,4 @@ exports.ProductionConfig = (bobConfig) => {
59
59
  }
60
60
  };
61
61
  };
62
+ exports.ProductionConfig = ProductionConfig;
@@ -6,4 +6,5 @@ var Preset;
6
6
  Preset["VUE_TYPESCRIPT"] = "vue-typescript";
7
7
  Preset["TYPESCRIPT"] = "typescript";
8
8
  Preset["JAVASCRIPT"] = "javascript";
9
+ Preset["VUE_TYPESCRIPT_NO_CODE_SPLITTING"] = "vue-typescript-no-code-splitting";
9
10
  })(Preset = exports.Preset || (exports.Preset = {}));
@@ -9,6 +9,7 @@ const preset_1 = require("../enums/preset");
9
9
  const vue_typescript_preset_1 = require("../presets/vue-typescript.preset");
10
10
  const typescript_preset_1 = require("../presets/typescript.preset");
11
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");
12
13
  const mode_1 = require("../enums/mode");
13
14
  const production_config_1 = require("../defaults/production.config");
14
15
  const development_config_1 = require("../defaults/development.config");
@@ -30,8 +31,9 @@ class Configuration {
30
31
  const configPrd = options[mode_1.Mode.PRODUCTION] ? options[mode_1.Mode.PRODUCTION] : {};
31
32
  this.environmentSpecificConfig = {
32
33
  [mode_1.Mode.DEVELOPMENT]: merge([configDev, development_config_1.DevelopmentConfig]) || development_config_1.DevelopmentConfig,
33
- [mode_1.Mode.PRODUCTION]: merge([configPrd, production_config_1.ProductionConfig(this.bob)]) || production_config_1.ProductionConfig(this.bob)
34
+ [mode_1.Mode.PRODUCTION]: merge([configPrd, (0, production_config_1.ProductionConfig)(this.bob)]) || (0, production_config_1.ProductionConfig)(this.bob)
34
35
  };
36
+ this.fileName = options.output.fileName || "[name]";
35
37
  }
36
38
  get(mode) {
37
39
  this.detectPresets(mode);
@@ -63,6 +65,9 @@ class Configuration {
63
65
  case preset_1.Preset.JAVASCRIPT:
64
66
  this.injectPreset(new javascript_preset_1.JavascriptPreset());
65
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;
66
71
  default:
67
72
  break;
68
73
  }
@@ -108,12 +113,13 @@ class Configuration {
108
113
  return dependencies;
109
114
  }
110
115
  getCSSFileName() {
116
+ const fileName = this.fileName || `style`;
111
117
  if (this.hash === false
112
118
  || typeof this.hash.css !== 'undefined'
113
119
  && this.hash.css === false) {
114
- return 'style.css';
120
+ return `${fileName}.css`;
115
121
  }
116
- return 'style.[fullhash].css';
122
+ return `${fileName}.[fullhash].css`;
117
123
  }
118
124
  }
119
125
  exports.Configuration = Configuration;
@@ -30,13 +30,24 @@ class TypeScriptPreset {
30
30
  },
31
31
  {
32
32
  test: /\.tsx?$/,
33
- loader: 'ts-loader',
34
- exclude: /node_modules\/(?!@studyportals\/).*/
33
+ exclude: /node_modules\/(?!@studyportals\/).*/,
34
+ use: [
35
+ {
36
+ loader: 'babel-loader',
37
+ },
38
+ {
39
+ loader: 'ts-loader'
40
+ }
41
+ ],
35
42
  },
36
43
  {
37
44
  test: /\.js$/,
38
- loader: 'babel-loader',
39
- exclude: /node_modules\/(?!@studyportals\/).*/
45
+ exclude: /node_modules\/(?!@studyportals\/).*/,
46
+ use: [
47
+ {
48
+ loader: 'babel-loader',
49
+ }
50
+ ]
40
51
  },
41
52
  {
42
53
  test: /\.(png|jpg|gif|svg)$/,
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VueTypescriptNoCodeSplittingPreset = void 0;
4
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5
+ const VueLoaderPlugin = require('vue-loader').VueLoaderPlugin;
6
+ const vue_typescript_preset_1 = require("./vue-typescript.preset");
7
+ class VueTypescriptNoCodeSplittingPreset extends vue_typescript_preset_1.VueTypeScriptPreset {
8
+ constructor(mode) {
9
+ super(mode);
10
+ }
11
+ getPlugins(filename) {
12
+ return [
13
+ new MiniCssExtractPlugin({
14
+ filename
15
+ }),
16
+ new VueLoaderPlugin()
17
+ ];
18
+ }
19
+ }
20
+ exports.VueTypescriptNoCodeSplittingPreset = VueTypescriptNoCodeSplittingPreset;
@@ -15,7 +15,8 @@ class VueTypeScriptPreset {
15
15
  manifest: require(`@studyportals/vue-config/dist/vue3_library${this.mode === mode_1.Mode.PRODUCTION ? '.min' : ''}.json`)
16
16
  }),
17
17
  new MiniCssExtractPlugin({
18
- filename
18
+ filename,
19
+ ignoreOrder: true
19
20
  }),
20
21
  new VueLoaderPlugin()
21
22
  ];
@@ -54,15 +55,26 @@ class VueTypeScriptPreset {
54
55
  },
55
56
  {
56
57
  test: /\.tsx?$/,
57
- loader: 'ts-loader',
58
- exclude: /node_modules\/(?!@studyportals\/).*/,
59
- options: {
60
- appendTsSuffixTo: [/\.vue$/]
61
- },
58
+ use: [
59
+ {
60
+ loader: 'babel-loader'
61
+ },
62
+ {
63
+ loader: 'ts-loader',
64
+ options: {
65
+ appendTsSuffixTo: [/\.vue$/]
66
+ }
67
+ }
68
+ ],
69
+ exclude: /node_modules\/(?!@studyportals\/).*/
62
70
  },
63
71
  {
64
72
  test: /\.js$/,
65
- loader: 'babel-loader',
73
+ use: [
74
+ {
75
+ loader: 'babel-loader'
76
+ }
77
+ ],
66
78
  exclude: /node_modules\/(?!@studyportals\/).*/
67
79
  },
68
80
  {