@pixolith/webpack-sw6-config 7.0.0 → 7.0.2
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 +3 -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 +29 -55
- 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.2",
|
|
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": "3ab953477c9f86b856b61fd10f0899b6189d1389",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/core": "^7.21.3",
|
|
27
27
|
"@babel/eslint-parser": "^7.21.3",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"postcss-loader": "^7.0.2",
|
|
68
68
|
"postcss-scss": "^4.0.6",
|
|
69
69
|
"prettier": "^2.8.4",
|
|
70
|
+
"process": "^0.11.10",
|
|
70
71
|
"rimraf": "^4.4.0",
|
|
71
72
|
"sass": "^1.59.3",
|
|
72
73
|
"sass-loader": "^13.2.0",
|
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,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: 'ws',
|
|
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,8 @@ module.exports = {
|
|
|
121
116
|
'Access-Control-Allow-Headers':
|
|
122
117
|
'X-Requested-With, content-type, Authorization',
|
|
123
118
|
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
? {
|
|
127
|
-
ca: fs.readFileSync(
|
|
128
|
-
Path.join(
|
|
129
|
-
process.cwd() +
|
|
130
|
-
'/.ddev/ssl/_wildcard.px-staging.de+1-client.pem',
|
|
131
|
-
),
|
|
132
|
-
),
|
|
133
|
-
key: fs.readFileSync(
|
|
134
|
-
Path.join(
|
|
135
|
-
process.cwd() +
|
|
136
|
-
'/.ddev/ssl/_wildcard.px-staging.de+1-key.pem',
|
|
137
|
-
),
|
|
138
|
-
),
|
|
139
|
-
cert: fs.readFileSync(
|
|
140
|
-
Path.join(
|
|
141
|
-
process.cwd() +
|
|
142
|
-
'/.ddev/ssl/_wildcard.px-staging.de+1.pem',
|
|
143
|
-
),
|
|
144
|
-
),
|
|
145
|
-
}
|
|
146
|
-
: false,
|
|
147
|
-
after() {
|
|
119
|
+
server: 'http',
|
|
120
|
+
onAfterSetupMiddleware: function(devServer) {
|
|
148
121
|
if (!isProd) {
|
|
149
122
|
Consola.success(
|
|
150
123
|
`Starting webpack in [${process.env.NODE_ENV}] with [${process.env.SHOPWARE_MODE}]`,
|
|
@@ -156,9 +129,8 @@ module.exports = {
|
|
|
156
129
|
plugins: [
|
|
157
130
|
new ESLintPlugin({
|
|
158
131
|
exclude: [
|
|
159
|
-
'node_modules',
|
|
160
|
-
'vendor
|
|
161
|
-
'vendor/shopware'
|
|
132
|
+
'**/node_modules/**',
|
|
133
|
+
'vendor'
|
|
162
134
|
]
|
|
163
135
|
}),
|
|
164
136
|
new HookPlugin({
|
|
@@ -186,7 +158,7 @@ module.exports = {
|
|
|
186
158
|
}),
|
|
187
159
|
|
|
188
160
|
new FilenameLinterPlugin({
|
|
189
|
-
ignoreFiles: [/node_modules/, /custom\/apps/, /vendor
|
|
161
|
+
ignoreFiles: [/node_modules/, /custom\/apps/, /vendor/],
|
|
190
162
|
rules: {
|
|
191
163
|
// check cases here https://github.com/blakeembrey/change-case
|
|
192
164
|
scss: 'paramCase',
|
|
@@ -197,6 +169,10 @@ module.exports = {
|
|
|
197
169
|
},
|
|
198
170
|
}),
|
|
199
171
|
|
|
172
|
+
new webpack.ProvidePlugin({
|
|
173
|
+
process: '../../../../process/browser.js',
|
|
174
|
+
}),
|
|
175
|
+
|
|
200
176
|
new TimeFixPlugin(),
|
|
201
177
|
|
|
202
178
|
new webpack.DefinePlugin({
|
|
@@ -216,17 +192,15 @@ module.exports = {
|
|
|
216
192
|
// '@media(min-width:1280px)': 'desktop',
|
|
217
193
|
// }
|
|
218
194
|
//}),
|
|
219
|
-
new CssMinimizerPlugin(),
|
|
220
195
|
].concat(
|
|
221
196
|
Glob.sync(Path.join(privatePath, '/**/*.s?(a|c)ss')).length
|
|
222
197
|
? new StyleLintPlugin({
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
198
|
+
files: '**/Pxsw*/**/*.s?(a|c)ss',
|
|
199
|
+
failOnError: false,
|
|
200
|
+
fix: false,
|
|
201
|
+
configFile: Path.join(__dirname, 'stylelint.config.js'),
|
|
202
|
+
})
|
|
228
203
|
: [],
|
|
229
204
|
),
|
|
230
205
|
watch: false,
|
|
231
|
-
stats: 'errors-warnings',
|
|
232
206
|
};
|
|
@@ -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: {
|