@machtwatch/react-script 1.2.11-alpha.23 → 1.2.11-alpha.25
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/bin/react-script.js +2 -2
- package/package.json +9 -9
- package/scripts/webpack.config.js +88 -23
package/bin/react-script.js
CHANGED
|
@@ -106,7 +106,7 @@ switch (script) {
|
|
|
106
106
|
delete require.cache[__filename];
|
|
107
107
|
|
|
108
108
|
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
109
|
-
const module = require(path.resolve(`${__dirname
|
|
109
|
+
const module = require(path.resolve(`${__dirname}/../scripts/${script}`));
|
|
110
110
|
|
|
111
111
|
run(module).catch((err) => {
|
|
112
112
|
console.error(err.stack);
|
|
@@ -155,6 +155,6 @@ switch (script) {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
default:
|
|
158
|
-
console.log(`Unknown script "${
|
|
158
|
+
console.log(`Unknown script "${script}".`);
|
|
159
159
|
break;
|
|
160
160
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@machtwatch/react-script",
|
|
3
|
-
"version": "1.2.11-alpha.
|
|
3
|
+
"version": "1.2.11-alpha.25",
|
|
4
4
|
"description": "Machtwatch React script",
|
|
5
5
|
"author": "Danny Reza Miloen <danny@machtwatch.co.id>",
|
|
6
6
|
"contributors": [],
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@testing-library/jest-dom": "^5.12.0",
|
|
56
56
|
"@testing-library/react": "^11.2.7",
|
|
57
57
|
"assets-webpack-plugin": "7.1.1",
|
|
58
|
-
"autoprefixer": "^
|
|
58
|
+
"autoprefixer": "^10.4.20",
|
|
59
59
|
"babel-jest": "^26.3.0",
|
|
60
60
|
"babel-loader": "^8.2.5",
|
|
61
61
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"browser-sync": "^2.26.7",
|
|
65
65
|
"child_process": "^1.0.2",
|
|
66
66
|
"compression-webpack-plugin": "^10.0.0",
|
|
67
|
-
"config": "^3.
|
|
67
|
+
"config": "^3.3.9",
|
|
68
68
|
"core-js": "^3.23.3",
|
|
69
|
-
"css-loader": "^
|
|
69
|
+
"css-loader": "^7.1.2",
|
|
70
70
|
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
71
71
|
"deepmerge": "^4.3.1",
|
|
72
72
|
"dotenv": "^5.0.1",
|
|
@@ -80,16 +80,16 @@
|
|
|
80
80
|
"imagemin-webp-webpack-plugin": "^3.3.6",
|
|
81
81
|
"intersection-observer": "^0.5.1",
|
|
82
82
|
"jest": "^26.4.2",
|
|
83
|
-
"less": "^4.1
|
|
84
|
-
"less-loader": "
|
|
83
|
+
"less": "^4.2.1",
|
|
84
|
+
"less-loader": "^12.2.0",
|
|
85
85
|
"mini-css-extract-plugin": "^2.6.1",
|
|
86
86
|
"mkdirp": "^0.5.1",
|
|
87
87
|
"null-loader": "^4.0.1",
|
|
88
88
|
"object-assign": "^4.1.1",
|
|
89
|
-
"postcss": "^8.
|
|
89
|
+
"postcss": "^8.5.0",
|
|
90
90
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
91
91
|
"postcss-import": "^14.1.0",
|
|
92
|
-
"postcss-loader": "^
|
|
92
|
+
"postcss-loader": "^8.1.1",
|
|
93
93
|
"postcss-preset-env": "^7.7.1",
|
|
94
94
|
"promise": "^8.0.2",
|
|
95
95
|
"purgecss-webpack-plugin": "^4.1.3",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"serialize-javascript": "^6.0.0",
|
|
102
102
|
"simple-progress-webpack-plugin": "^2.0.0",
|
|
103
103
|
"speed-measure-webpack-plugin": "^1.5.0",
|
|
104
|
-
"style-loader": "^
|
|
104
|
+
"style-loader": "^4.0.0",
|
|
105
105
|
"stylelint": "^16.10.0",
|
|
106
106
|
"stylelint-config-recommended-less": "^3.0.1",
|
|
107
107
|
"stylelint-webpack-plugin": "^5.0.1",
|
|
@@ -3,7 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const glob = require('glob-all');
|
|
4
4
|
const webpack = require('webpack');
|
|
5
5
|
const nodeExternals = require('webpack-node-externals');
|
|
6
|
-
const { BundleAnalyzerPlugin }
|
|
6
|
+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
7
7
|
const AssetsPlugin = require('assets-webpack-plugin');
|
|
8
8
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
9
9
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
@@ -29,7 +29,7 @@ const visitedFrameworkPackages = new Set();
|
|
|
29
29
|
|
|
30
30
|
const {
|
|
31
31
|
argv,
|
|
32
|
-
env
|
|
32
|
+
env: {
|
|
33
33
|
NODE_ENV,
|
|
34
34
|
APPHOST,
|
|
35
35
|
PUBLIC_PATH,
|
|
@@ -68,7 +68,7 @@ console.log(
|
|
|
68
68
|
isAnalyze,
|
|
69
69
|
config_compiler: config.compiler_public_path,
|
|
70
70
|
compression: USE_STATIC_COMPRESSION,
|
|
71
|
-
}).reduce((a, [k, v]) =>
|
|
71
|
+
}).reduce((a, [k, v]) => a += `${k}: ${v}\n`, '\n')
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
//Generate SW Environment Config
|
|
@@ -86,7 +86,7 @@ class GenerateSWEnvPlugin {
|
|
|
86
86
|
}
|
|
87
87
|
`
|
|
88
88
|
);
|
|
89
|
-
fs.writeFileSync(`${paths.appBuild
|
|
89
|
+
fs.writeFileSync(`${paths.appBuild}/public/env.js`,
|
|
90
90
|
`
|
|
91
91
|
var env = {
|
|
92
92
|
FIREBASE_SENDER_ID: ${FIREBASE_SENDER_ID}
|
|
@@ -118,7 +118,7 @@ const addPackagePath = (packageName, relativeToPath) => {
|
|
|
118
118
|
const directory = path.join(packageJsonPath, '../');
|
|
119
119
|
|
|
120
120
|
// Returning from the function in case the directory has already been added and traversed
|
|
121
|
-
if (topLevelFrameworkPaths.includes(directory)) {return;}
|
|
121
|
+
if (topLevelFrameworkPaths.includes(directory)) { return; }
|
|
122
122
|
topLevelFrameworkPaths.push(directory);
|
|
123
123
|
|
|
124
124
|
const dependencies = require(packageJsonPath).dependencies || {};
|
|
@@ -136,13 +136,13 @@ for (const packageName of ['react', 'react-dom', 'react-router', 'scheduler', 'u
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
const isModuleCSS = module => (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
// mini-css-extract-plugin
|
|
140
|
+
module.type === 'css/mini-extract' ||
|
|
141
|
+
// extract-css-chunks-webpack-plugin (old)
|
|
142
|
+
module.type === 'css/extract-chunks' ||
|
|
143
|
+
// extract-css-chunks-webpack-plugin (new)
|
|
144
|
+
module.type === 'css/extract-css-chunks'
|
|
145
|
+
);
|
|
146
146
|
|
|
147
147
|
//
|
|
148
148
|
// Common configuration chunk to be used for both
|
|
@@ -279,7 +279,7 @@ const styleLoaders = ({ isClient }) => [
|
|
|
279
279
|
options: {
|
|
280
280
|
modules: {
|
|
281
281
|
exportOnlyLocals: !isClient,
|
|
282
|
-
localIdentName:'[local]',
|
|
282
|
+
localIdentName: '[local]',
|
|
283
283
|
},
|
|
284
284
|
importLoaders: 2,
|
|
285
285
|
},
|
|
@@ -324,7 +324,7 @@ const styleLoaders = ({ isClient }) => [
|
|
|
324
324
|
lessOptions: {
|
|
325
325
|
javascriptEnabled: true,
|
|
326
326
|
paths: [
|
|
327
|
-
`${paths.appSrc}/styles
|
|
327
|
+
`${paths.appSrc}/styles`,
|
|
328
328
|
`${paths.appPath}/node_modules/@machtwatch/react-ui`,
|
|
329
329
|
],
|
|
330
330
|
}
|
|
@@ -360,8 +360,8 @@ const clientConfig = {
|
|
|
360
360
|
|
|
361
361
|
return resource
|
|
362
362
|
? topLevelFrameworkPaths.some((pkgPath) =>
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
resource.startsWith(pkgPath)
|
|
364
|
+
)
|
|
365
365
|
: false;
|
|
366
366
|
},
|
|
367
367
|
priority: 40,
|
|
@@ -477,13 +477,70 @@ const clientConfig = {
|
|
|
477
477
|
rules: [
|
|
478
478
|
...baseClientConfig.module.rules,
|
|
479
479
|
{
|
|
480
|
-
test: /\.
|
|
480
|
+
test: /\.css$/,
|
|
481
481
|
use: [
|
|
482
|
+
MiniCssExtractPlugin.loader,
|
|
483
|
+
{
|
|
484
|
+
loader: 'css-loader',
|
|
485
|
+
options: {
|
|
486
|
+
modules: {
|
|
487
|
+
exportOnlyLocals: false,
|
|
488
|
+
localIdentName: '[local]',
|
|
489
|
+
},
|
|
490
|
+
importLoaders: 1,
|
|
491
|
+
},
|
|
492
|
+
},
|
|
482
493
|
{
|
|
483
|
-
loader:
|
|
494
|
+
loader: 'postcss-loader',
|
|
495
|
+
options: {
|
|
496
|
+
postcssOptions: {
|
|
497
|
+
ident: 'postcss',
|
|
498
|
+
config: false,
|
|
499
|
+
plugins: [
|
|
500
|
+
[
|
|
501
|
+
'postcss-import',
|
|
502
|
+
{
|
|
503
|
+
addModulesDirectories: [
|
|
504
|
+
path.resolve(__dirname, '../node_modules'),
|
|
505
|
+
`${paths.appPath}/node_modules`
|
|
506
|
+
],
|
|
507
|
+
root: `${paths.appSrc}/styles/`
|
|
508
|
+
}
|
|
509
|
+
],
|
|
510
|
+
[
|
|
511
|
+
'postcss-preset-env',
|
|
512
|
+
{
|
|
513
|
+
autoprefixer: { flexbox: 'no-2009' },
|
|
514
|
+
stage: 3,
|
|
515
|
+
browsers: pkg.browserslist,
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
'tailwindcss',
|
|
519
|
+
'postcss-modules-values',
|
|
520
|
+
'postcss-flexbugs-fixes',
|
|
521
|
+
],
|
|
522
|
+
},
|
|
523
|
+
},
|
|
484
524
|
},
|
|
485
|
-
|
|
486
|
-
|
|
525
|
+
],
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
test: /\.less$/,
|
|
529
|
+
use: [
|
|
530
|
+
MiniCssExtractPlugin.loader,
|
|
531
|
+
...styleLoaders({ isClient: true }).filter(
|
|
532
|
+
(loader) => loader.loader !== 'less-loader'
|
|
533
|
+
),
|
|
534
|
+
{
|
|
535
|
+
loader: 'less-loader',
|
|
536
|
+
options: {
|
|
537
|
+
lessOptions: {
|
|
538
|
+
javascriptEnabled: true,
|
|
539
|
+
paths: [`${paths.appSrc}/styles`],
|
|
540
|
+
},
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
],
|
|
487
544
|
}
|
|
488
545
|
]
|
|
489
546
|
},
|
|
@@ -659,18 +716,26 @@ const serverConfig = {
|
|
|
659
716
|
},
|
|
660
717
|
module: {
|
|
661
718
|
...baseServerConfig.module,
|
|
662
|
-
rules:[
|
|
719
|
+
rules: [
|
|
663
720
|
...baseServerConfig.module.rules,
|
|
664
721
|
{
|
|
665
|
-
test: /\.
|
|
722
|
+
test: /\.css$/,
|
|
723
|
+
use: styleLoaders({ isClient: false }).filter(
|
|
724
|
+
(loader) => loader.loader !== 'less-loader'
|
|
725
|
+
),
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
test: /\.less$/,
|
|
666
729
|
use: styleLoaders({ isClient: false }),
|
|
667
730
|
},
|
|
668
731
|
],
|
|
669
732
|
},
|
|
670
733
|
externalsPresets: { node: true },
|
|
671
734
|
externals: [
|
|
735
|
+
nodeExternals({
|
|
736
|
+
allowlist: [/^driver\.js/],
|
|
737
|
+
}),
|
|
672
738
|
/^\.\/assets\.json$/,
|
|
673
|
-
nodeExternals({ allowlist: /(@machtwatch\/react-ui|\.(css|less|scss|sss)$)/i })
|
|
674
739
|
],
|
|
675
740
|
plugins: [
|
|
676
741
|
...baseServerConfig.plugins,
|