@machtwatch/react-script 1.2.11-alpha.25 → 1.2.11-alpha.27
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.
|
@@ -1,66 +1,70 @@
|
|
|
1
1
|
module.exports = () => ({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
],
|
|
20
|
-
require('@babel/preset-react'),
|
|
21
|
-
|
|
2
|
+
customOptions({ transform_runtime, isClient, ...loader }) {
|
|
3
|
+
return {
|
|
4
|
+
loader,
|
|
5
|
+
custom: { ...transform_runtime, isClient }
|
|
6
|
+
};
|
|
7
|
+
},
|
|
8
|
+
config(cfg) {
|
|
9
|
+
return {
|
|
10
|
+
...cfg.options,
|
|
11
|
+
presets: [
|
|
12
|
+
[
|
|
13
|
+
require('@babel/preset-env'),
|
|
14
|
+
{
|
|
15
|
+
modules: false,
|
|
16
|
+
useBuiltIns: 'usage',
|
|
17
|
+
corejs: '3.22'
|
|
18
|
+
}
|
|
22
19
|
],
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
20
|
+
require('@babel/preset-react'),
|
|
21
|
+
|
|
22
|
+
],
|
|
23
|
+
plugins: [
|
|
24
|
+
require('@babel/plugin-transform-runtime'),
|
|
25
|
+
require('@babel/plugin-proposal-function-bind'),
|
|
26
|
+
require('@babel/plugin-proposal-export-default-from'),
|
|
27
|
+
require('@babel/plugin-proposal-export-namespace-from'),
|
|
28
|
+
require('@babel/plugin-proposal-throw-expressions'),
|
|
29
|
+
require('@babel/plugin-syntax-dynamic-import'),
|
|
30
|
+
require('@babel/plugin-proposal-json-strings'),
|
|
31
|
+
require('@loadable/babel-plugin'),
|
|
32
|
+
[require('babel-plugin-transform-imports'), {
|
|
33
|
+
'@machtwatch/react-ui': {
|
|
34
|
+
transform: '@machtwatch/react-ui/lib/${member}',
|
|
35
|
+
preventFullImport: true
|
|
36
|
+
}
|
|
37
|
+
}],
|
|
38
|
+
[require('@babel/plugin-proposal-decorators'), {
|
|
39
|
+
legacy: true
|
|
40
|
+
}],
|
|
41
|
+
[require('@babel/plugin-proposal-optional-chaining'), {
|
|
42
|
+
loose: true
|
|
43
|
+
}],
|
|
44
|
+
[require('@babel/plugin-proposal-class-properties'), {
|
|
45
|
+
loose: true
|
|
46
|
+
}],
|
|
47
|
+
[require('@babel/plugin-proposal-private-methods'), { loose: true }],
|
|
48
|
+
[require('@babel/plugin-proposal-private-property-in-object'), { loose: true }],
|
|
49
|
+
[require('babel-plugin-add-module-exports'), {
|
|
50
|
+
addDefaultProperty: true
|
|
51
|
+
}],
|
|
52
|
+
...(cfg.options.isClient && !cfg.options.compact ? [
|
|
53
|
+
require.resolve('react-refresh/babel')
|
|
54
|
+
] : [
|
|
52
55
|
...(cfg.options.compact ? [
|
|
53
56
|
require('@babel/plugin-transform-react-inline-elements'),
|
|
54
57
|
require('@babel/plugin-transform-react-constant-elements')
|
|
55
|
-
] : [])
|
|
56
|
-
|
|
57
|
-
]
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
58
|
+
] : [])
|
|
59
|
+
]),
|
|
60
|
+
...(cfg.options.plugins || [])
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
result(result) {
|
|
65
|
+
return {
|
|
66
|
+
...result,
|
|
67
|
+
code: `${result.code} \n// Generated by babel-custom-loader`
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
});
|
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.27",
|
|
4
4
|
"description": "Machtwatch React script",
|
|
5
5
|
"author": "Danny Reza Miloen <danny@machtwatch.co.id>",
|
|
6
6
|
"contributors": [],
|
|
@@ -51,9 +51,10 @@
|
|
|
51
51
|
"@babel/preset-react": "^7.17.12",
|
|
52
52
|
"@loadable/babel-plugin": "^5.13.2",
|
|
53
53
|
"@loadable/webpack-plugin": "^5.15.2",
|
|
54
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.6.2",
|
|
54
55
|
"@svgr/webpack": "^6.2.1",
|
|
55
56
|
"@testing-library/jest-dom": "^5.12.0",
|
|
56
|
-
"@testing-library/react": "
|
|
57
|
+
"@testing-library/react": "13.0.0",
|
|
57
58
|
"assets-webpack-plugin": "7.1.1",
|
|
58
59
|
"autoprefixer": "^10.4.20",
|
|
59
60
|
"babel-jest": "^26.3.0",
|
|
@@ -91,10 +92,14 @@
|
|
|
91
92
|
"postcss-import": "^14.1.0",
|
|
92
93
|
"postcss-loader": "^8.1.1",
|
|
93
94
|
"postcss-preset-env": "^7.7.1",
|
|
95
|
+
"process": "0.11.10",
|
|
94
96
|
"promise": "^8.0.2",
|
|
95
97
|
"purgecss-webpack-plugin": "^4.1.3",
|
|
98
|
+
"react": "18.3.1",
|
|
96
99
|
"react-dev-utils": "^12.0.1",
|
|
97
|
-
"react-
|
|
100
|
+
"react-dom": "18.3.1",
|
|
101
|
+
"react-error-overlay": "6.0.11",
|
|
102
|
+
"react-refresh": "0.18.0",
|
|
98
103
|
"recluster": "^0.4.5",
|
|
99
104
|
"regenerator-runtime": "^0.13.3",
|
|
100
105
|
"rimraf": "^2.6.3",
|
|
@@ -10,38 +10,38 @@ const {
|
|
|
10
10
|
stopReportingRuntimeErrors,
|
|
11
11
|
} = require('react-error-overlay');
|
|
12
12
|
|
|
13
|
-
setEditorHandler(errorLocation => {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
// setEditorHandler(errorLocation => {
|
|
14
|
+
// const fileName = encodeURIComponent(errorLocation.fileName);
|
|
15
|
+
// const lineNumber = encodeURIComponent(errorLocation.lineNumber || 1);
|
|
16
|
+
//
|
|
17
|
+
// fetch(
|
|
18
|
+
// // Keep in sync with react-dev-utils/errorOverlayMiddleware
|
|
19
|
+
// `${launchEditorEndpoint}?fileName=${fileName}&lineNumber=${lineNumber}`,
|
|
20
|
+
// );
|
|
21
|
+
// });
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
reportBuildError(formatted.errors[0]);
|
|
31
|
-
},
|
|
32
|
-
clear() {
|
|
33
|
-
dismissBuildError();
|
|
34
|
-
},
|
|
35
|
-
});
|
|
23
|
+
// hotClient.useCustomOverlay({
|
|
24
|
+
// showProblems(type, errors) {
|
|
25
|
+
// const formatted = formatWebpackMessages({
|
|
26
|
+
// errors,
|
|
27
|
+
// warnings: [],
|
|
28
|
+
// });
|
|
29
|
+
//
|
|
30
|
+
// reportBuildError(formatted.errors[0]);
|
|
31
|
+
// },
|
|
32
|
+
// clear() {
|
|
33
|
+
// dismissBuildError();
|
|
34
|
+
// },
|
|
35
|
+
// });
|
|
36
36
|
|
|
37
37
|
hotClient.setOptionsAndConnect({
|
|
38
38
|
name: 'client',
|
|
39
39
|
reload: true,
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
startReportingRuntimeErrors({
|
|
43
|
-
|
|
44
|
-
});
|
|
42
|
+
// startReportingRuntimeErrors({
|
|
43
|
+
// filename: '/assets/client.js',
|
|
44
|
+
// });
|
|
45
45
|
|
|
46
46
|
if (module.hot) {
|
|
47
47
|
module.hot.dispose(stopReportingRuntimeErrors);
|
package/scripts/start.js
CHANGED
|
@@ -13,6 +13,8 @@ const clean = require('./utils/clean');
|
|
|
13
13
|
|
|
14
14
|
const config = require('config').util.loadFileConfigs(`${paths.appPath}/config`);
|
|
15
15
|
|
|
16
|
+
console.log('RUNNING LOCALL X')
|
|
17
|
+
|
|
16
18
|
const { format } = run;
|
|
17
19
|
|
|
18
20
|
// https://webpack.js.org/configuration/watch/#watchoptions
|
|
@@ -17,6 +17,7 @@ const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin');
|
|
|
17
17
|
const { SubresourceIntegrityPlugin } = require('webpack-subresource-integrity');
|
|
18
18
|
const crypto = require('crypto');
|
|
19
19
|
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
|
|
20
|
+
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
20
21
|
|
|
21
22
|
const paths = require('../config/paths');
|
|
22
23
|
|
|
@@ -167,9 +168,12 @@ const webpackConfig = ({ isClient }) => ({
|
|
|
167
168
|
'@hooks': path.resolve(paths.appSrc, 'hooks'),
|
|
168
169
|
'@components': path.resolve(paths.appSrc, 'components'),
|
|
169
170
|
'@baseComponents': path.resolve(paths.appSrc, 'base_components'),
|
|
170
|
-
'react/jsx-
|
|
171
|
-
'react/jsx-runtime': 'react/jsx-runtime
|
|
171
|
+
'react/jsx-runtime': require.resolve('react/jsx-runtime'),
|
|
172
|
+
'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime'),
|
|
173
|
+
'react/jsx-runtime.js': require.resolve('react/jsx-runtime'),
|
|
174
|
+
'react/jsx-dev-runtime.js': require.resolve('react/jsx-dev-runtime'),
|
|
172
175
|
},
|
|
176
|
+
conditionNames: ['import', 'require', 'node', 'default'],
|
|
173
177
|
},
|
|
174
178
|
|
|
175
179
|
resolveLoader: {
|
|
@@ -194,6 +198,7 @@ const webpackConfig = ({ isClient }) => ({
|
|
|
194
198
|
babelrc: false,
|
|
195
199
|
configFile: false,
|
|
196
200
|
compact: isProdEnv,
|
|
201
|
+
isClient,
|
|
197
202
|
cacheDirectory: true,
|
|
198
203
|
cacheCompression: false,
|
|
199
204
|
customize: path.resolve(__dirname, '../config/babel/babel-custom-loader.js'),
|
|
@@ -207,6 +212,9 @@ const webpackConfig = ({ isClient }) => ({
|
|
|
207
212
|
test: /\.mjs$/,
|
|
208
213
|
include: /node_modules/,
|
|
209
214
|
type: 'javascript/auto',
|
|
215
|
+
resolve: {
|
|
216
|
+
fullySpecified: false,
|
|
217
|
+
}
|
|
210
218
|
},
|
|
211
219
|
{
|
|
212
220
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
@@ -551,6 +559,9 @@ const clientConfig = {
|
|
|
551
559
|
extensions: ['less'],
|
|
552
560
|
exclude: ['node_modules', 'coverage'],
|
|
553
561
|
}),
|
|
562
|
+
isRuntimeDev && new ReactRefreshWebpackPlugin({
|
|
563
|
+
overlay: false,
|
|
564
|
+
}),
|
|
554
565
|
new webpack.HotModuleReplacementPlugin(),
|
|
555
566
|
new SubresourceIntegrityPlugin(),
|
|
556
567
|
new LoadablePlugin({
|
|
@@ -568,6 +579,9 @@ const clientConfig = {
|
|
|
568
579
|
'process.env.BROWSER': true,
|
|
569
580
|
__DEVTOOLS__: isVerbose // <-------- DISABLE redux-devtools HERE
|
|
570
581
|
}),
|
|
582
|
+
new webpack.ProvidePlugin({
|
|
583
|
+
process: 'process/browser.js',
|
|
584
|
+
}),
|
|
571
585
|
|
|
572
586
|
new MiniCssExtractPlugin({
|
|
573
587
|
// Options similar to the same options in webpackOptions.output
|