@pixolith/webpack-sw6-config 7.1.2 → 7.2.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 +5 -4
- package/src/postcss.config.js +15 -0
- package/src/webpack.config.dev.js +51 -55
- package/src/webpack.config.production.js +15 -0
- package/src/.postcssrc.js +0 -22
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixolith/webpack-sw6-config",
|
|
3
3
|
"public": true,
|
|
4
|
-
"version": "7.1
|
|
4
|
+
"version": "7.2.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"scripts": {},
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://github.com/pixolith/webpack-plugins/issues"
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/pixolith/webpack-plugins/tree/master/packages/webpack-hook-plugin/#readme",
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "07b8912cd6b9e25da138e3236199de3bec79a58b",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/core": "^7.22.1",
|
|
27
27
|
"@babel/eslint-parser": "^7.21.8",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@babel/plugin-transform-runtime": "^7.22.4",
|
|
34
34
|
"@babel/preset-env": "^7.22.4",
|
|
35
35
|
"@babel/preset-typescript": "^7.21.5",
|
|
36
|
-
"@pixolith/eslint-config-sw6": "^7.0
|
|
36
|
+
"@pixolith/eslint-config-sw6": "^7.2.0",
|
|
37
37
|
"@pixolith/external-svg-sprite-loader": "^7.1.2",
|
|
38
|
-
"@pixolith/stylelint-config-standard": "^7.0
|
|
38
|
+
"@pixolith/stylelint-config-standard": "^7.2.0",
|
|
39
39
|
"@pixolith/webpack-assets-copy-plugin": "^7.1.0",
|
|
40
40
|
"@pixolith/webpack-filename-linter-plugin": "^7.0.0",
|
|
41
41
|
"@pixolith/webpack-hook-plugin": "^7.0.0",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"media-query-plugin": "^1.5.0",
|
|
67
67
|
"postcss": "^8.4.24",
|
|
68
68
|
"postcss-loader": "^7.3.2",
|
|
69
|
+
"postcss-pxtorem": "^6.0.0",
|
|
69
70
|
"postcss-scss": "^4.0.6",
|
|
70
71
|
"prettier": "^2.8.8",
|
|
71
72
|
"rimraf": "^5.0.1",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = ({ file, options, env }) => {
|
|
2
|
+
return {
|
|
3
|
+
plugins: {
|
|
4
|
+
// to edit target browsers: use "browserslist" field in package.json
|
|
5
|
+
autoprefixer: {
|
|
6
|
+
env: options.mode + (options.isModern ? ':modern' : ''),
|
|
7
|
+
},
|
|
8
|
+
'postcss-pxtorem': {
|
|
9
|
+
rootValue: 16,
|
|
10
|
+
unitPrecision: 5,
|
|
11
|
+
propList: ['*']
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -3,7 +3,6 @@ const webpack = require('webpack'),
|
|
|
3
3
|
Consola = require('consola'),
|
|
4
4
|
fs = require('fs'),
|
|
5
5
|
ASSET_URL = process.env.ASSET_URL || '/',
|
|
6
|
-
CssMinimizerPlugin = require('css-minimizer-webpack-plugin'),
|
|
7
6
|
StyleLintPlugin = require('stylelint-webpack-plugin'),
|
|
8
7
|
isProd = process.env.NODE_ENV === 'production',
|
|
9
8
|
privatePath = process.env.PLUGIN_PATH,
|
|
@@ -57,6 +56,9 @@ module.exports = {
|
|
|
57
56
|
loader: 'postcss-loader',
|
|
58
57
|
options: {
|
|
59
58
|
sourceMap: !isProd,
|
|
59
|
+
postcssOptions: {
|
|
60
|
+
config: Path.resolve(__dirname, 'postcss.config.js'),
|
|
61
|
+
},
|
|
60
62
|
},
|
|
61
63
|
},
|
|
62
64
|
{
|
|
@@ -91,29 +93,22 @@ module.exports = {
|
|
|
91
93
|
},
|
|
92
94
|
],
|
|
93
95
|
},
|
|
94
|
-
{
|
|
95
|
-
test: /\.js$/,
|
|
96
|
-
loader: 'string-replace-loader',
|
|
97
|
-
options: {
|
|
98
|
-
search:
|
|
99
|
-
"import PluginManager from 'src/plugin-system/plugin.manager'",
|
|
100
|
-
//match, p1, offset, string
|
|
101
|
-
replace: () => 'const PluginManager = window.PluginManager',
|
|
102
|
-
flags: 'g',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
96
|
],
|
|
106
97
|
},
|
|
98
|
+
stats: 'errors-warnings',
|
|
107
99
|
devServer: {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
100
|
+
allowedHosts: 'all',
|
|
101
|
+
client: {
|
|
102
|
+
webSocketURL: {
|
|
103
|
+
hostname: 'node.px-staging.de',
|
|
104
|
+
protocol: 'wss',
|
|
105
|
+
port: 8080,
|
|
106
|
+
},
|
|
107
|
+
overlay: {
|
|
108
|
+
warnings: false,
|
|
109
|
+
errors: true,
|
|
110
|
+
},
|
|
115
111
|
},
|
|
116
|
-
writeToDisk: true,
|
|
117
112
|
headers: {
|
|
118
113
|
'Access-Control-Allow-Origin': '*',
|
|
119
114
|
'Access-Control-Allow-Methods':
|
|
@@ -121,30 +116,35 @@ module.exports = {
|
|
|
121
116
|
'Access-Control-Allow-Headers':
|
|
122
117
|
'X-Requested-With, content-type, Authorization',
|
|
123
118
|
},
|
|
124
|
-
|
|
125
|
-
https: !isProd
|
|
119
|
+
server: !isProd
|
|
126
120
|
? {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
121
|
+
type: 'https',
|
|
122
|
+
options: {
|
|
123
|
+
ca: fs.readFileSync(
|
|
124
|
+
Path.join(
|
|
125
|
+
process.cwd() +
|
|
126
|
+
'/.ddev/ssl/_wildcard.px-staging.de+1-client.pem',
|
|
127
|
+
),
|
|
128
|
+
),
|
|
129
|
+
key: fs.readFileSync(
|
|
130
|
+
Path.join(
|
|
131
|
+
process.cwd() +
|
|
132
|
+
'/.ddev/ssl/_wildcard.px-staging.de+1-key.pem',
|
|
133
|
+
),
|
|
134
|
+
),
|
|
135
|
+
cert: fs.readFileSync(
|
|
136
|
+
Path.join(
|
|
137
|
+
process.cwd() +
|
|
138
|
+
'/.ddev/ssl/_wildcard.px-staging.de+1.pem',
|
|
139
|
+
),
|
|
140
|
+
),
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
: 'http',
|
|
144
|
+
devMiddleware: {
|
|
145
|
+
writeToDisk: true,
|
|
146
|
+
},
|
|
147
|
+
onAfterSetupMiddleware: function(devServer) {
|
|
148
148
|
if (!isProd) {
|
|
149
149
|
Consola.success(
|
|
150
150
|
`Starting webpack in [${process.env.NODE_ENV}] with [${process.env.SHOPWARE_MODE}]`,
|
|
@@ -156,9 +156,8 @@ module.exports = {
|
|
|
156
156
|
plugins: [
|
|
157
157
|
new ESLintPlugin({
|
|
158
158
|
exclude: [
|
|
159
|
-
'node_modules',
|
|
160
|
-
'vendor
|
|
161
|
-
'vendor/shopware'
|
|
159
|
+
'**/node_modules/**',
|
|
160
|
+
'vendor'
|
|
162
161
|
]
|
|
163
162
|
}),
|
|
164
163
|
new HookPlugin({
|
|
@@ -186,7 +185,7 @@ module.exports = {
|
|
|
186
185
|
}),
|
|
187
186
|
|
|
188
187
|
new FilenameLinterPlugin({
|
|
189
|
-
ignoreFiles: [/node_modules/, /custom\/apps/, /vendor
|
|
188
|
+
ignoreFiles: [/node_modules/, /custom\/apps/, /vendor/],
|
|
190
189
|
rules: {
|
|
191
190
|
// check cases here https://github.com/blakeembrey/change-case
|
|
192
191
|
scss: 'paramCase',
|
|
@@ -196,7 +195,6 @@ module.exports = {
|
|
|
196
195
|
svg: 'paramCase',
|
|
197
196
|
},
|
|
198
197
|
}),
|
|
199
|
-
|
|
200
198
|
new TimeFixPlugin(),
|
|
201
199
|
|
|
202
200
|
new webpack.DefinePlugin({
|
|
@@ -216,17 +214,15 @@ module.exports = {
|
|
|
216
214
|
// '@media(min-width:1280px)': 'desktop',
|
|
217
215
|
// }
|
|
218
216
|
//}),
|
|
219
|
-
new CssMinimizerPlugin(),
|
|
220
217
|
].concat(
|
|
221
218
|
Glob.sync(Path.join(privatePath, '/**/*.s?(a|c)ss')).length
|
|
222
219
|
? new StyleLintPlugin({
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
220
|
+
files: '**/Pxsw*/**/*.s?(a|c)ss',
|
|
221
|
+
failOnError: false,
|
|
222
|
+
fix: false,
|
|
223
|
+
configFile: Path.join(__dirname, 'stylelint.config.js'),
|
|
224
|
+
})
|
|
228
225
|
: [],
|
|
229
226
|
),
|
|
230
227
|
watch: false,
|
|
231
|
-
stats: 'errors-warnings',
|
|
232
228
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const webpack = require('webpack'),
|
|
2
2
|
TerserPlugin = require('terser-webpack-plugin'),
|
|
3
|
+
CssMinimizerPlugin = require('css-minimizer-webpack-plugin'),
|
|
3
4
|
isModern = process.env.MODE === 'modern',
|
|
4
5
|
config = {
|
|
5
6
|
devtool: 'nosources-source-map',
|
|
@@ -14,7 +15,21 @@ const webpack = require('webpack'),
|
|
|
14
15
|
removeAvailableModules: true,
|
|
15
16
|
removeEmptyChunks: true,
|
|
16
17
|
sideEffects: false,
|
|
18
|
+
minimize: true,
|
|
17
19
|
minimizer: [
|
|
20
|
+
new CssMinimizerPlugin({
|
|
21
|
+
minimizerOptions: {
|
|
22
|
+
preset: [
|
|
23
|
+
"advanced",
|
|
24
|
+
{
|
|
25
|
+
zIndex: false,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
minify: [
|
|
30
|
+
CssMinimizerPlugin.cssnanoMinify,
|
|
31
|
+
]
|
|
32
|
+
}),
|
|
18
33
|
new TerserPlugin({
|
|
19
34
|
terserOptions: {
|
|
20
35
|
compress: {
|
package/src/.postcssrc.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module.exports = ({ file, options, env }) => {
|
|
2
|
-
return {
|
|
3
|
-
plugins: {
|
|
4
|
-
// to edit target browsers: use "browserslist" field in package.json
|
|
5
|
-
autoprefixer: {
|
|
6
|
-
grid: true,
|
|
7
|
-
env: options.mode + (options.isModern ? ':modern' : ''),
|
|
8
|
-
},
|
|
9
|
-
cssnano: {
|
|
10
|
-
preset: [
|
|
11
|
-
'default',
|
|
12
|
-
{
|
|
13
|
-
discardComments: {
|
|
14
|
-
removeAll: true,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
zindex: false,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
};
|