@studyportals/webpack-helper 3.0.0-beta.9 → 3.0.1-beta.1
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 +4 -4
- package/src/defaults/development.config.js +1 -0
- package/src/defaults/production.config.js +1 -0
- package/src/enums/mode.js +1 -0
- package/src/enums/preset.js +1 -0
- package/src/factories/configuration-factory.js +1 -0
- package/src/model/configuration.js +4 -3
- package/src/model/entry.js +1 -0
- package/src/model/module.js +1 -0
- package/src/model/output.js +2 -1
- package/src/model/plugins.js +1 -0
- package/src/presets/javascript.preset.js +1 -0
- package/src/presets/typescript.preset.js +16 -4
- package/src/presets/vue-typescript.preset.js +17 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studyportals/webpack-helper",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1-beta.1",
|
|
4
4
|
"description": "A collection of standard configurations and helpers for webpack.",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@babel/preset-env": "^7.5.5",
|
|
29
29
|
"@babel/preset-typescript": "^7.3.3",
|
|
30
30
|
"@babel/runtime": "^7.5.5",
|
|
31
|
-
"@studyportals/bob-manifest-generator": "^
|
|
31
|
+
"@studyportals/bob-manifest-generator": "^3.0.0",
|
|
32
32
|
"@studyportals/browserslist-config": "^1.2.0",
|
|
33
|
-
"@studyportals/dll-availability-tracker": "^
|
|
34
|
-
"@studyportals/vue-config": "4.0.0
|
|
33
|
+
"@studyportals/dll-availability-tracker": "^2.0.0",
|
|
34
|
+
"@studyportals/vue-config": "^4.0.0",
|
|
35
35
|
"babel-loader": "^8.2.3",
|
|
36
36
|
"css-loader": "^6.5.1",
|
|
37
37
|
"file-loader": "^6.2.0",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductionConfig = void 0;
|
|
3
4
|
const webpack = require('webpack');
|
|
4
5
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
5
6
|
const DllAvailabilityTracker = require('@studyportals/dll-availability-tracker');
|
package/src/enums/mode.js
CHANGED
package/src/enums/preset.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Configuration = void 0;
|
|
3
4
|
const entry_1 = require("./entry");
|
|
4
5
|
const output_1 = require("./output");
|
|
5
6
|
const plugins_1 = require("./plugins");
|
|
@@ -31,9 +32,9 @@ class Configuration {
|
|
|
31
32
|
[mode_1.Mode.DEVELOPMENT]: merge([configDev, development_config_1.DevelopmentConfig]) || development_config_1.DevelopmentConfig,
|
|
32
33
|
[mode_1.Mode.PRODUCTION]: merge([configPrd, production_config_1.ProductionConfig(this.bob)]) || production_config_1.ProductionConfig(this.bob)
|
|
33
34
|
};
|
|
34
|
-
this.detectPresets();
|
|
35
35
|
}
|
|
36
36
|
get(mode) {
|
|
37
|
+
this.detectPresets(mode);
|
|
37
38
|
return merge({
|
|
38
39
|
entry: this.entry.getEntry(),
|
|
39
40
|
output: this.output.getOutput(),
|
|
@@ -51,10 +52,10 @@ class Configuration {
|
|
|
51
52
|
devtool: 'source-map'
|
|
52
53
|
}, this.getBobConfig(), this.commonConfig, this.getEnvironmentSpecificConfig(mode), { mode });
|
|
53
54
|
}
|
|
54
|
-
detectPresets() {
|
|
55
|
+
detectPresets(mode) {
|
|
55
56
|
switch (this.preset) {
|
|
56
57
|
case preset_1.Preset.VUE_TYPESCRIPT:
|
|
57
|
-
this.injectPreset(new vue_typescript_preset_1.VueTypeScriptPreset());
|
|
58
|
+
this.injectPreset(new vue_typescript_preset_1.VueTypeScriptPreset(mode));
|
|
58
59
|
break;
|
|
59
60
|
case preset_1.Preset.TYPESCRIPT:
|
|
60
61
|
this.injectPreset(new typescript_preset_1.TypeScriptPreset());
|
package/src/model/entry.js
CHANGED
package/src/model/module.js
CHANGED
package/src/model/output.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Output = void 0;
|
|
3
4
|
class Output {
|
|
4
5
|
constructor(outputConfig) {
|
|
5
6
|
this.path = outputConfig.path;
|
|
6
|
-
this.publicPath = outputConfig.publicPath
|
|
7
|
+
this.publicPath = typeof outputConfig.publicPath === "string" ? outputConfig.publicPath : null;
|
|
7
8
|
this.library = outputConfig.library || null;
|
|
8
9
|
this.addHash = this.shouldAddHash(outputConfig.hash),
|
|
9
10
|
this.fileName = outputConfig.fileName || "[name]";
|
package/src/model/plugins.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeScriptPreset = void 0;
|
|
3
4
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
4
5
|
class TypeScriptPreset {
|
|
5
6
|
getPlugins(filename) {
|
|
@@ -29,13 +30,24 @@ class TypeScriptPreset {
|
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
test: /\.tsx?$/,
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
exclude: /node_modules\/(?!@studyportals\/).*/,
|
|
34
|
+
use: [
|
|
35
|
+
{
|
|
36
|
+
loader: 'babel-loader',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
loader: 'ts-loader'
|
|
40
|
+
}
|
|
41
|
+
],
|
|
34
42
|
},
|
|
35
43
|
{
|
|
36
44
|
test: /\.js$/,
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
exclude: /node_modules\/(?!@studyportals\/).*/,
|
|
46
|
+
use: [
|
|
47
|
+
{
|
|
48
|
+
loader: 'babel-loader',
|
|
49
|
+
}
|
|
50
|
+
]
|
|
39
51
|
},
|
|
40
52
|
{
|
|
41
53
|
test: /\.(png|jpg|gif|svg)$/,
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VueTypeScriptPreset = void 0;
|
|
4
|
+
const mode_1 = require("../enums/mode");
|
|
3
5
|
const webpack = require("webpack");
|
|
4
6
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
5
7
|
const VueLoaderPlugin = require('vue-loader').VueLoaderPlugin;
|
|
6
8
|
class VueTypeScriptPreset {
|
|
9
|
+
constructor(mode) {
|
|
10
|
+
this.mode = mode;
|
|
11
|
+
}
|
|
7
12
|
getPlugins(filename) {
|
|
8
13
|
return [
|
|
9
14
|
new webpack.DllReferencePlugin({
|
|
10
|
-
manifest: require(
|
|
15
|
+
manifest: require(`@studyportals/vue-config/dist/vue3_library${this.mode === mode_1.Mode.PRODUCTION ? '.min' : ''}.json`)
|
|
11
16
|
}),
|
|
12
17
|
new MiniCssExtractPlugin({
|
|
13
18
|
filename
|
|
@@ -43,16 +48,22 @@ class VueTypeScriptPreset {
|
|
|
43
48
|
'css-loader',
|
|
44
49
|
'sass-loader'
|
|
45
50
|
]
|
|
46
|
-
}
|
|
51
|
+
},
|
|
52
|
+
hotReload: false
|
|
47
53
|
}
|
|
48
54
|
},
|
|
49
55
|
{
|
|
50
56
|
test: /\.tsx?$/,
|
|
51
|
-
loader: 'ts-loader',
|
|
52
57
|
exclude: /node_modules\/(?!@studyportals\/).*/,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
use: [
|
|
59
|
+
{
|
|
60
|
+
loader: 'babel-loader',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
loader: 'ts-loader',
|
|
64
|
+
appendTsSuffixTo: [/\.vue$/]
|
|
65
|
+
}
|
|
66
|
+
],
|
|
56
67
|
},
|
|
57
68
|
{
|
|
58
69
|
test: /\.js$/,
|