@pixolith/webpack-sw6-config 7.0.0 → 7.0.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 +2 -2
- package/src/.postcssrc.js +9 -11
- package/src/babel.config.js +0 -7
- package/src/postcss.config.js +20 -0
- package/src/webpack.config.dev.js +14 -27
- package/src/webpack.config.production.js +14 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixolith/webpack-sw6-config",
|
|
3
3
|
"public": true,
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.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": "9349ab5ac9d0505c2d15ead9ba9da1eff743e2a7",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/core": "^7.21.3",
|
|
27
27
|
"@babel/eslint-parser": "^7.21.3",
|
package/src/.postcssrc.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
module.exports = ({ file, options, env }) => {
|
|
2
2
|
return {
|
|
3
|
+
minimizerOptions: {
|
|
4
|
+
preset: [
|
|
5
|
+
'default',
|
|
6
|
+
{
|
|
7
|
+
discardComments: { removeAll: true },
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
zindex: false,
|
|
11
|
+
},
|
|
3
12
|
plugins: {
|
|
4
13
|
// to edit target browsers: use "browserslist" field in package.json
|
|
5
14
|
autoprefixer: {
|
|
6
15
|
grid: true,
|
|
7
16
|
env: options.mode + (options.isModern ? ':modern' : ''),
|
|
8
17
|
},
|
|
9
|
-
cssnano: {
|
|
10
|
-
preset: [
|
|
11
|
-
'default',
|
|
12
|
-
{
|
|
13
|
-
discardComments: {
|
|
14
|
-
removeAll: true,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
zindex: false,
|
|
19
|
-
},
|
|
20
18
|
},
|
|
21
19
|
};
|
|
22
20
|
};
|
package/src/babel.config.js
CHANGED
|
@@ -7,13 +7,6 @@ module.exports = {
|
|
|
7
7
|
corejs: 3,
|
|
8
8
|
debug: false,
|
|
9
9
|
useBuiltIns: 'usage',
|
|
10
|
-
targets: {
|
|
11
|
-
browsers: require(process.cwd() + '/package.json')
|
|
12
|
-
.browserslist[
|
|
13
|
-
process.env.SHOPWARE_MODE +
|
|
14
|
-
(process.env.MODE ? ':modern' : '')
|
|
15
|
-
],
|
|
16
|
-
},
|
|
17
10
|
},
|
|
18
11
|
],
|
|
19
12
|
],
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module.exports = ({ file, options, env }) => {
|
|
2
|
+
return {
|
|
3
|
+
minimizerOptions: {
|
|
4
|
+
preset: [
|
|
5
|
+
'default',
|
|
6
|
+
{
|
|
7
|
+
discardComments: { removeAll: true },
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
zindex: false,
|
|
11
|
+
},
|
|
12
|
+
plugins: {
|
|
13
|
+
// to edit target browsers: use "browserslist" field in package.json
|
|
14
|
+
//autoprefixer: {
|
|
15
|
+
// grid: true,
|
|
16
|
+
// env: options.mode + (options.isModern ? ':modern' : ''),
|
|
17
|
+
//},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -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,18 @@ 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: 'https://node.px-staging.de:8080',
|
|
103
|
+
overlay: {
|
|
104
|
+
warnings: false,
|
|
105
|
+
errors: true,
|
|
106
|
+
},
|
|
115
107
|
},
|
|
116
|
-
writeToDisk: true,
|
|
117
108
|
headers: {
|
|
118
109
|
'Access-Control-Allow-Origin': '*',
|
|
119
110
|
'Access-Control-Allow-Methods':
|
|
@@ -121,7 +112,6 @@ module.exports = {
|
|
|
121
112
|
'Access-Control-Allow-Headers':
|
|
122
113
|
'X-Requested-With, content-type, Authorization',
|
|
123
114
|
},
|
|
124
|
-
stats: 'errors-warnings',
|
|
125
115
|
https: !isProd
|
|
126
116
|
? {
|
|
127
117
|
ca: fs.readFileSync(
|
|
@@ -144,7 +134,7 @@ module.exports = {
|
|
|
144
134
|
),
|
|
145
135
|
}
|
|
146
136
|
: false,
|
|
147
|
-
|
|
137
|
+
onAfterSetupMiddleware: function(devServer) {
|
|
148
138
|
if (!isProd) {
|
|
149
139
|
Consola.success(
|
|
150
140
|
`Starting webpack in [${process.env.NODE_ENV}] with [${process.env.SHOPWARE_MODE}]`,
|
|
@@ -157,8 +147,7 @@ module.exports = {
|
|
|
157
147
|
new ESLintPlugin({
|
|
158
148
|
exclude: [
|
|
159
149
|
'node_modules',
|
|
160
|
-
'vendor
|
|
161
|
-
'vendor/shopware'
|
|
150
|
+
'vendor'
|
|
162
151
|
]
|
|
163
152
|
}),
|
|
164
153
|
new HookPlugin({
|
|
@@ -186,7 +175,7 @@ module.exports = {
|
|
|
186
175
|
}),
|
|
187
176
|
|
|
188
177
|
new FilenameLinterPlugin({
|
|
189
|
-
ignoreFiles: [/node_modules/, /custom\/apps/, /vendor
|
|
178
|
+
ignoreFiles: [/node_modules/, /custom\/apps/, /vendor/],
|
|
190
179
|
rules: {
|
|
191
180
|
// check cases here https://github.com/blakeembrey/change-case
|
|
192
181
|
scss: 'paramCase',
|
|
@@ -216,7 +205,6 @@ module.exports = {
|
|
|
216
205
|
// '@media(min-width:1280px)': 'desktop',
|
|
217
206
|
// }
|
|
218
207
|
//}),
|
|
219
|
-
new CssMinimizerPlugin(),
|
|
220
208
|
].concat(
|
|
221
209
|
Glob.sync(Path.join(privatePath, '/**/*.s?(a|c)ss')).length
|
|
222
210
|
? new StyleLintPlugin({
|
|
@@ -228,5 +216,4 @@ module.exports = {
|
|
|
228
216
|
: [],
|
|
229
217
|
),
|
|
230
218
|
watch: false,
|
|
231
|
-
stats: 'errors-warnings',
|
|
232
219
|
};
|
|
@@ -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',
|
|
@@ -15,6 +16,19 @@ const webpack = require('webpack'),
|
|
|
15
16
|
removeEmptyChunks: true,
|
|
16
17
|
sideEffects: false,
|
|
17
18
|
minimizer: [
|
|
19
|
+
new CssMinimizerPlugin({
|
|
20
|
+
minimizerOptions: {
|
|
21
|
+
preset: [
|
|
22
|
+
"default",
|
|
23
|
+
{
|
|
24
|
+
discardComments: { removeAll: true },
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
minify: [
|
|
29
|
+
CssMinimizerPlugin.cssnanoMinify,
|
|
30
|
+
]
|
|
31
|
+
}),
|
|
18
32
|
new TerserPlugin({
|
|
19
33
|
terserOptions: {
|
|
20
34
|
compress: {
|