@studyportals/webpack-helper 3.0.0-beta.8 → 3.0.0-beta.9

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/README.md CHANGED
@@ -4,6 +4,7 @@ WebpackHelper is a utility that makes it easy to set up a webpack configuration
4
4
 
5
5
  ## Table of Contents
6
6
  - [Webpack version](#webpack-version)
7
+ - [Notes on updating Webpack from v4 to v5](#notes-on-updating-webpack-from-v4-to-v5)
7
8
  - [Quick Start](#quick-start)
8
9
  - [Configuration](#configuration)
9
10
  - [entry](#entry-required)
@@ -22,6 +23,50 @@ WebpackHelper is a utility that makes it easy to set up a webpack configuration
22
23
  ## Webpack version
23
24
  This version of WebpackHelper is based on webpack 5. Some earlier WebpackHelper versions used earlier versions of Webpack. If you get syntax errors when updating to the latest version of WebpackHelper, please check out the [Webpack documentation](https://webpack.js.org/configuration/).
24
25
 
26
+ ### Notes on updating Webpack from v4 to v5
27
+ Below are some notes that might be helpful when you're upgrading a microservice from webpack-helper v2 (based on Webpack v4) to v3 (based on Webpack v5).
28
+
29
+ #### Dev server
30
+ Webpack-helper **v2 and below**: Your `development.devServer` file might include these parts:
31
+ ```javascript
32
+ {
33
+ development: {
34
+ devServer: {
35
+ open: true,
36
+ overlay: true,
37
+ writeToDisk: true
38
+ }
39
+ }
40
+ }
41
+ ```
42
+ Webpack-helper **v3 and beyond**: Your `webpack.config.js` file should configure those parts like this:
43
+ ```javascript
44
+ {
45
+ development: {
46
+ devServer: {
47
+ client: {
48
+ overlay: true
49
+ },
50
+ devMiddleware: {
51
+ writeToDisk: true
52
+ },
53
+ open: true,
54
+ static: path.join(__dirname, '.') // Related to writeToDisk.
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ #### Exporting
61
+ Webpack-helper **v2 and below**: Your `webpack.config.js` file ended with the following:
62
+ ```javascript
63
+ module.exports = mode => configuration.get(mode);
64
+ ```
65
+ Webpack-helper **v3 and beyond**: Your `webpack.config.js` file should end with the following (as is also mentioned further below):
66
+ ```javascript
67
+ module.exports = (env, details) => configuration.get(details.mode);
68
+ ```
69
+
25
70
  ## Quick Start
26
71
 
27
72
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/webpack-helper",
3
- "version": "3.0.0-beta.8",
3
+ "version": "3.0.0-beta.9",
4
4
  "description": "A collection of standard configurations and helpers for webpack.",
5
5
  "main": "src/main.js",
6
6
  "scripts": {
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DevelopmentConfig = void 0;
4
3
  exports.DevelopmentConfig = {
5
4
  optimization: {
6
5
  minimize: false
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductionConfig = void 0;
4
3
  const webpack = require('webpack');
5
4
  const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
6
5
  const DllAvailabilityTracker = require('@studyportals/dll-availability-tracker');
package/src/enums/mode.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mode = void 0;
4
3
  var Mode;
5
4
  (function (Mode) {
6
5
  Mode["DEVELOPMENT"] = "development";
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Preset = void 0;
4
3
  var Preset;
5
4
  (function (Preset) {
6
5
  Preset["VUE_TYPESCRIPT"] = "vue-typescript";
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigurationFactory = void 0;
4
3
  const configuration_1 = require("../model/configuration");
5
4
  class ConfigurationFactory {
6
5
  create(options) {
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Configuration = void 0;
4
3
  const entry_1 = require("./entry");
5
4
  const output_1 = require("./output");
6
5
  const plugins_1 = require("./plugins");
@@ -26,9 +25,11 @@ class Configuration {
26
25
  this.plugins = new plugins_1.Plugins(options.plugins);
27
26
  this.module = new module_1.Module(options.module);
28
27
  this.commonConfig = options.common || {};
28
+ const configDev = options[mode_1.Mode.DEVELOPMENT] ? options[mode_1.Mode.DEVELOPMENT] : {};
29
+ const configPrd = options[mode_1.Mode.PRODUCTION] ? options[mode_1.Mode.PRODUCTION] : {};
29
30
  this.environmentSpecificConfig = {
30
- [mode_1.Mode.DEVELOPMENT]: merge([options[mode_1.Mode.DEVELOPMENT], development_config_1.DevelopmentConfig]) || development_config_1.DevelopmentConfig,
31
- [mode_1.Mode.PRODUCTION]: merge([options[mode_1.Mode.PRODUCTION], production_config_1.ProductionConfig(this.bob)]) || production_config_1.ProductionConfig(this.bob)
31
+ [mode_1.Mode.DEVELOPMENT]: merge([configDev, development_config_1.DevelopmentConfig]) || development_config_1.DevelopmentConfig,
32
+ [mode_1.Mode.PRODUCTION]: merge([configPrd, production_config_1.ProductionConfig(this.bob)]) || production_config_1.ProductionConfig(this.bob)
32
33
  };
33
34
  this.detectPresets();
34
35
  }
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Entry = void 0;
4
3
  class Entry {
5
4
  constructor(entry) {
6
5
  this.entry = entry;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Module = void 0;
4
3
  const { merge } = require('webpack-merge');
5
4
  class Module {
6
5
  constructor(module = {}) {
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Output = void 0;
4
3
  class Output {
5
4
  constructor(outputConfig) {
6
5
  this.path = outputConfig.path;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Plugins = void 0;
4
3
  class Plugins {
5
4
  constructor(plugins = []) {
6
5
  this.plugins = [];
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JavascriptPreset = void 0;
4
3
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5
4
  class JavascriptPreset {
6
5
  getPlugins(filename) {
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeScriptPreset = void 0;
4
3
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5
4
  class TypeScriptPreset {
6
5
  getPlugins(filename) {
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VueTypeScriptPreset = void 0;
4
3
  const webpack = require("webpack");
5
4
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6
5
  const VueLoaderPlugin = require('vue-loader').VueLoaderPlugin;