@nitro/webpack 7.2.5 → 7.4.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,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitro/webpack",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "nitro webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "The Nitro Team",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": ">=14.15.0 <
|
|
9
|
-
"npm": ">=6.14.8 <
|
|
8
|
+
"node": ">=14.15.0 <19",
|
|
9
|
+
"npm": ">=6.14.8 <10"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"lint": "eslint .",
|
|
@@ -23,18 +23,15 @@
|
|
|
23
23
|
"nitro"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@babel/core": "7.21.
|
|
27
|
-
"@babel/preset-env": "7.
|
|
26
|
+
"@babel/core": "7.21.4",
|
|
27
|
+
"@babel/preset-env": "7.21.4",
|
|
28
28
|
"@babel/preset-react": "7.18.6",
|
|
29
29
|
"@babel/plugin-proposal-decorators": "7.21.0",
|
|
30
30
|
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
31
31
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
32
|
-
"autoprefixer": "10.4.
|
|
32
|
+
"autoprefixer": "10.4.14",
|
|
33
33
|
"case-sensitive-paths-webpack-plugin": "2.4.0",
|
|
34
34
|
"css-loader": "5.2.7",
|
|
35
|
-
"eslint": "7.32.0",
|
|
36
|
-
"eslint-webpack-plugin": "2.7.0",
|
|
37
|
-
"eslint-plugin-import": "2.27.5",
|
|
38
35
|
"file-loader": "6.2.0",
|
|
39
36
|
"handlebars-loader": "1.7.3",
|
|
40
37
|
"iconfont-webpack-plugin": "5.0.1",
|
|
@@ -46,10 +43,8 @@
|
|
|
46
43
|
"postcss": "8.4.21",
|
|
47
44
|
"postcss-loader": "4.3.0",
|
|
48
45
|
"resolve-url-loader": "5.0.0",
|
|
49
|
-
"sass": "1.
|
|
46
|
+
"sass": "1.60.0",
|
|
50
47
|
"sass-loader": "10.4.1",
|
|
51
|
-
"stylelint": "14.16.1",
|
|
52
|
-
"stylelint-webpack-plugin": "2.4.0",
|
|
53
48
|
"svgo": "3.0.2",
|
|
54
49
|
"ts-config-webpack-plugin": "2.0.3",
|
|
55
50
|
"typescript": "4.9.5",
|
|
@@ -65,7 +60,9 @@
|
|
|
65
60
|
"imagemin-svgo": "9.0.0"
|
|
66
61
|
},
|
|
67
62
|
"devDependencies": {
|
|
68
|
-
"@merkle-open/eslint-config": "1.0.0"
|
|
63
|
+
"@merkle-open/eslint-config": "1.0.0",
|
|
64
|
+
"eslint": "7.32.0",
|
|
65
|
+
"eslint-plugin-import": "2.27.5"
|
|
69
66
|
},
|
|
70
67
|
"publishConfig": {
|
|
71
68
|
"access": "public"
|
package/readme.md
CHANGED
|
@@ -11,13 +11,9 @@ Configurable and easy to use webpack 4 config for nitro projects.
|
|
|
11
11
|
```
|
|
12
12
|
const options = {
|
|
13
13
|
rules: {
|
|
14
|
-
js:
|
|
15
|
-
eslint: false,
|
|
16
|
-
},
|
|
14
|
+
js: true,
|
|
17
15
|
ts: false,
|
|
18
|
-
scss:
|
|
19
|
-
stylelint: false,
|
|
20
|
-
},
|
|
16
|
+
scss: true,
|
|
21
17
|
hbs: true,
|
|
22
18
|
woff: true,
|
|
23
19
|
font: false,
|
|
@@ -50,7 +46,6 @@ No loader rule is enabled by default. Activate following prepared rules you need
|
|
|
50
46
|
Config:
|
|
51
47
|
|
|
52
48
|
- `true` or `{}` activates JavaScript support
|
|
53
|
-
- `{ eslint: true }` additionally adds eslint live linting feature (only relevant for development build)
|
|
54
49
|
|
|
55
50
|
#### `options.rules.ts`
|
|
56
51
|
|
|
@@ -71,7 +66,6 @@ Config:
|
|
|
71
66
|
Config:
|
|
72
67
|
|
|
73
68
|
- `true` or `{}` will activate scss support
|
|
74
|
-
- `{ stylelint: true }` additionally adds stylelint live linting feature (only relevant for development build)
|
|
75
69
|
- `{ publicPath: '../' }` provide a separate public path for stylesheets. By default, webpack uses the value from 'output.publicPath'. (only relevant for production build)
|
|
76
70
|
- `{ implementation: require('node-sass') }` gives the possibility to use 'node-sass' as sass implementation. (you have to add 'node-sass' as a dev-dependency in your project)
|
|
77
71
|
|
|
@@ -112,7 +106,7 @@ Config:
|
|
|
112
106
|
- `{ exclude: [] }` additionally adds exclude config to rule
|
|
113
107
|
|
|
114
108
|
⚠ Please use this rule with care. You have to configure includes and exclude when you also use woff and/or image loader.
|
|
115
|
-
Otherwise svg or woff files are processed with multiple configurations.
|
|
109
|
+
Otherwise, svg or woff files are processed with multiple configurations.
|
|
116
110
|
|
|
117
111
|
#### `options.rules.image`
|
|
118
112
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const fs = require('fs');
|
|
3
|
+
const crypto = require('crypto');
|
|
3
4
|
const webpack = require('webpack');
|
|
4
5
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
5
6
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
6
|
-
const ESLintPlugin = require('eslint-webpack-plugin');
|
|
7
7
|
const JsConfigWebpackPlugin = require('js-config-webpack-plugin');
|
|
8
8
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
9
|
-
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
|
10
9
|
const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');
|
|
11
10
|
const DynamicAliasResolverPlugin = require('../plugins/dynamicAliasResolver');
|
|
12
11
|
const utils = require('../lib/utils');
|
|
@@ -14,6 +13,10 @@ const utils = require('../lib/utils');
|
|
|
14
13
|
const hotMiddlewareScript = 'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true';
|
|
15
14
|
const appDirectory = fs.realpathSync(process.cwd());
|
|
16
15
|
|
|
16
|
+
// hack: OpenSSL 3 does not support md4 anymore, but legacy webpack 4 hardcoded it: https://github.com/webpack/webpack/issues/13572
|
|
17
|
+
const crypto_orig_createHash = crypto.createHash;
|
|
18
|
+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm === 'md4' ? 'sha256' : algorithm);
|
|
19
|
+
|
|
17
20
|
module.exports = (options = { rules: {}, features: {} }) => {
|
|
18
21
|
const webpackConfig = {
|
|
19
22
|
mode: 'development',
|
|
@@ -103,14 +106,6 @@ module.exports = (options = { rules: {}, features: {} }) => {
|
|
|
103
106
|
// js
|
|
104
107
|
if (options.rules.js) {
|
|
105
108
|
webpackConfig.plugins.push(new JsConfigWebpackPlugin({ babelConfigFile: './babel.config.js' }));
|
|
106
|
-
|
|
107
|
-
// eslint live validation
|
|
108
|
-
if (options.rules.js.eslint) {
|
|
109
|
-
const esLintPluginOptions = {
|
|
110
|
-
lintDirtyModulesOnly: true,
|
|
111
|
-
};
|
|
112
|
-
webpackConfig.plugins.push(new ESLintPlugin(esLintPluginOptions));
|
|
113
|
-
}
|
|
114
109
|
}
|
|
115
110
|
|
|
116
111
|
// typescript
|
|
@@ -177,20 +172,6 @@ module.exports = (options = { rules: {}, features: {} }) => {
|
|
|
177
172
|
filename: '[file].map',
|
|
178
173
|
})
|
|
179
174
|
);
|
|
180
|
-
|
|
181
|
-
// stylelint live validation
|
|
182
|
-
if (options.rules.scss.stylelint) {
|
|
183
|
-
webpackConfig.plugins.push(
|
|
184
|
-
new StyleLintPlugin({
|
|
185
|
-
files: ['src/**/*.?(s)css'],
|
|
186
|
-
// lintDirtyModulesOnly: true,
|
|
187
|
-
syntax: 'scss',
|
|
188
|
-
quiet: false,
|
|
189
|
-
failOnError: false,
|
|
190
|
-
emitErrors: true,
|
|
191
|
-
})
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
175
|
}
|
|
195
176
|
|
|
196
177
|
// handlebars precompiled templates
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const fs = require('fs');
|
|
3
|
+
const crypto = require('crypto');
|
|
3
4
|
const webpack = require('webpack');
|
|
4
5
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
5
6
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
@@ -11,6 +12,10 @@ const WebpackBar = require('webpackbar');
|
|
|
11
12
|
const DynamicAliasResolverPlugin = require('../plugins/dynamicAliasResolver');
|
|
12
13
|
const utils = require('../lib/utils');
|
|
13
14
|
|
|
15
|
+
// hack: OpenSSL 3 does not support md4 anymore, but legacy webpack 4 hardcoded it: https://github.com/webpack/webpack/issues/13572
|
|
16
|
+
const crypto_orig_createHash = crypto.createHash;
|
|
17
|
+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm === 'md4' ? 'sha256' : algorithm);
|
|
18
|
+
|
|
14
19
|
const appDirectory = fs.realpathSync(process.cwd());
|
|
15
20
|
|
|
16
21
|
const bannerData = {
|