@machtwatch/react-script 1.2.11-alpha.30 → 1.2.11-alpha.32
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/config/babel/babel-custom-loader.js +61 -65
- package/config/jest/createJestConfig.js +1 -4
- package/config/jest/jest-setup.js +3 -0
- package/package.json +4 -8
- package/scripts/build.js +4 -14
- package/scripts/lib/webpackHotDevClient.js +25 -25
- package/scripts/start.js +7 -19
- package/scripts/test.js +18 -29
- package/scripts/utils/clean.js +3 -1
- package/scripts/webpack.config.js +11 -27
|
@@ -1,70 +1,66 @@
|
|
|
1
1
|
module.exports = () => ({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
customOptions({ transform_runtime, ...loader }) {
|
|
3
|
+
return {
|
|
4
|
+
loader,
|
|
5
|
+
custom: { ...transform_runtime }
|
|
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
|
+
}
|
|
19
|
+
],
|
|
20
|
+
require('@babel/preset-react'),
|
|
21
21
|
|
|
22
|
-
|
|
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
|
-
|
|
52
|
-
...(cfg.options.isClient && !cfg.options.compact ? [
|
|
53
|
-
require.resolve('react-refresh/babel')
|
|
54
|
-
] : [
|
|
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
|
+
}],
|
|
55
52
|
...(cfg.options.compact ? [
|
|
56
53
|
require('@babel/plugin-transform-react-inline-elements'),
|
|
57
54
|
require('@babel/plugin-transform-react-constant-elements')
|
|
58
|
-
] : [])
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
55
|
+
] : []),
|
|
56
|
+
...(cfg.options.plugins || [])
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
result(result) {
|
|
61
|
+
return {
|
|
62
|
+
...result,
|
|
63
|
+
code: `${result.code} \n// Generated by babel-custom-loader`
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
});
|
|
@@ -4,7 +4,7 @@ const path = require('path');
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const merge = require('deepmerge');
|
|
6
6
|
|
|
7
|
-
module.exports = (resolve, rootDir, srcRoots
|
|
7
|
+
module.exports = (resolve, rootDir, srcRoots) => {
|
|
8
8
|
const toRelRootDir = f => '<rootDir>/' + path.relative(rootDir || '', f);
|
|
9
9
|
const extendedPath = path.join(process.cwd(), 'extended-jest.config.js');
|
|
10
10
|
|
|
@@ -26,9 +26,6 @@ module.exports = (resolve, rootDir, srcRoots, appConfig) => {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const config = {
|
|
29
|
-
globals: {
|
|
30
|
-
CONFIG: appConfig && (appConfig.globals || appConfig),
|
|
31
|
-
},
|
|
32
29
|
setupFiles: [resolve('scripts/utils/polyfills.js')],
|
|
33
30
|
testMatch: [
|
|
34
31
|
"<rootDir>/src/shared/**/*.(spec|test).{js,jsx,mjs}"
|
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.32",
|
|
4
4
|
"description": "Machtwatch React script",
|
|
5
5
|
"author": "Danny Reza Miloen <danny@machtwatch.co.id>",
|
|
6
6
|
"contributors": [],
|
|
@@ -51,10 +51,9 @@
|
|
|
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",
|
|
55
54
|
"@svgr/webpack": "^6.2.1",
|
|
56
55
|
"@testing-library/jest-dom": "^5.12.0",
|
|
57
|
-
"@testing-library/react": "
|
|
56
|
+
"@testing-library/react": "^11.2.7",
|
|
58
57
|
"assets-webpack-plugin": "7.1.1",
|
|
59
58
|
"autoprefixer": "^10.4.20",
|
|
60
59
|
"babel-jest": "^26.3.0",
|
|
@@ -65,6 +64,7 @@
|
|
|
65
64
|
"browser-sync": "^2.26.7",
|
|
66
65
|
"child_process": "^1.0.2",
|
|
67
66
|
"compression-webpack-plugin": "^10.0.0",
|
|
67
|
+
"config": "^3.3.9",
|
|
68
68
|
"core-js": "^3.23.3",
|
|
69
69
|
"css-loader": "^7.1.2",
|
|
70
70
|
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
@@ -91,14 +91,10 @@
|
|
|
91
91
|
"postcss-import": "^14.1.0",
|
|
92
92
|
"postcss-loader": "^8.1.1",
|
|
93
93
|
"postcss-preset-env": "^7.7.1",
|
|
94
|
-
"process": "0.11.10",
|
|
95
94
|
"promise": "^8.0.2",
|
|
96
95
|
"purgecss-webpack-plugin": "^4.1.3",
|
|
97
|
-
"react": "18.3.1",
|
|
98
96
|
"react-dev-utils": "^12.0.1",
|
|
99
|
-
"react-
|
|
100
|
-
"react-error-overlay": "6.0.11",
|
|
101
|
-
"react-refresh": "0.18.0",
|
|
97
|
+
"react-error-overlay": "6.0.9",
|
|
102
98
|
"recluster": "^0.4.5",
|
|
103
99
|
"regenerator-runtime": "^0.13.3",
|
|
104
100
|
"rimraf": "^2.6.3",
|
package/scripts/build.js
CHANGED
|
@@ -5,18 +5,14 @@ const run = require('./utils/run');
|
|
|
5
5
|
const clean = require('./utils/clean');
|
|
6
6
|
const copy = require('./utils/copy');
|
|
7
7
|
const pkg = require('../package.json');
|
|
8
|
-
const
|
|
9
|
-
const { createRequire } = require('module');
|
|
10
|
-
|
|
11
|
-
const requireApp = createRequire(`${paths.appPath}/package.json`);
|
|
12
|
-
const { loadConfig } = requireApp('c12');
|
|
8
|
+
const webpackConfig = require('./webpack.config');
|
|
13
9
|
|
|
14
10
|
/**
|
|
15
11
|
* Compiles the project from source files into a distributable
|
|
16
12
|
* format and copies it to the output (build) folder.
|
|
17
13
|
*/
|
|
18
14
|
|
|
19
|
-
function bundle(
|
|
15
|
+
function bundle() {
|
|
20
16
|
return new Promise((resolve, reject) => {
|
|
21
17
|
webpack(webpackConfig).run((err, stats) => {
|
|
22
18
|
if (err) {
|
|
@@ -31,15 +27,9 @@ function bundle(webpackConfig) {
|
|
|
31
27
|
}
|
|
32
28
|
|
|
33
29
|
async function build() {
|
|
34
|
-
|
|
35
|
-
cwd: paths.appPath,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const webpackConfig = await require('./webpack.config')(config);
|
|
39
|
-
|
|
40
|
-
await run(clean, config);
|
|
30
|
+
await run(clean);
|
|
41
31
|
await run(copy);
|
|
42
|
-
await run(bundle
|
|
32
|
+
await run(bundle);
|
|
43
33
|
|
|
44
34
|
if (process.argv.includes('--docker')) {
|
|
45
35
|
cp.spawnSync('docker', ['build', '-t', pkg.name, '.'], { stdio: 'inherit' })
|
|
@@ -10,38 +10,38 @@ const {
|
|
|
10
10
|
stopReportingRuntimeErrors,
|
|
11
11
|
} = require('react-error-overlay');
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
// fetch(
|
|
18
|
-
// // Keep in sync with react-dev-utils/errorOverlayMiddleware
|
|
19
|
-
// `${launchEditorEndpoint}?fileName=${fileName}&lineNumber=${lineNumber}`,
|
|
20
|
-
// );
|
|
21
|
-
// });
|
|
13
|
+
setEditorHandler(errorLocation => {
|
|
14
|
+
const fileName = encodeURIComponent(errorLocation.fileName);
|
|
15
|
+
const lineNumber = encodeURIComponent(errorLocation.lineNumber || 1);
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
fetch(
|
|
18
|
+
// Keep in sync with react-dev-utils/errorOverlayMiddleware
|
|
19
|
+
`${launchEditorEndpoint}?fileName=${fileName}&lineNumber=${lineNumber}`,
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
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
|
-
|
|
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
|
@@ -7,13 +7,11 @@ const webpackHotMiddleware = require('webpack-hot-middleware');
|
|
|
7
7
|
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
|
|
8
8
|
|
|
9
9
|
const paths = require('../config/paths');
|
|
10
|
-
|
|
10
|
+
const webpackConfig = require('./webpack.config');
|
|
11
11
|
const run = require('./utils/run');
|
|
12
12
|
const clean = require('./utils/clean');
|
|
13
|
-
const { createRequire } = require('module');
|
|
14
13
|
|
|
15
|
-
const
|
|
16
|
-
const { loadConfig } = requireApp('c12');
|
|
14
|
+
const config = require('config').util.loadFileConfigs(`${paths.appPath}/config`);
|
|
17
15
|
|
|
18
16
|
const { format } = run;
|
|
19
17
|
|
|
@@ -71,18 +69,12 @@ async function start() {
|
|
|
71
69
|
return server;
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
const { config } = await loadConfig({
|
|
75
|
-
cwd: paths.appPath,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
const webpackConfig = await require('./webpack.config')(config);
|
|
79
|
-
|
|
80
72
|
server = express();
|
|
81
73
|
server.use(errorOverlayMiddleware());
|
|
82
74
|
server.use(express.static(paths.appPublic));
|
|
83
75
|
|
|
84
76
|
// Configure client-side hot module replacement
|
|
85
|
-
const clientConfig = webpackConfig.find(
|
|
77
|
+
const clientConfig = webpackConfig.find(config => config.name === 'client');
|
|
86
78
|
|
|
87
79
|
clientConfig.entry.client = [path.resolve(`${__dirname}/lib/webpackHotDevClient`)]
|
|
88
80
|
.concat(clientConfig.entry.client)
|
|
@@ -117,7 +109,7 @@ async function start() {
|
|
|
117
109
|
);
|
|
118
110
|
|
|
119
111
|
// Configure compilation
|
|
120
|
-
await run(clean
|
|
112
|
+
await run(clean);
|
|
121
113
|
|
|
122
114
|
const clientCompiler = webpack(clientConfig);
|
|
123
115
|
const serverCompiler = webpack(serverConfig);
|
|
@@ -195,14 +187,12 @@ async function start() {
|
|
|
195
187
|
checkForUpdate(true);
|
|
196
188
|
}
|
|
197
189
|
})
|
|
198
|
-
.catch(
|
|
190
|
+
.catch(error => {
|
|
199
191
|
if (['abort', 'fail'].includes(app.hot.status())) {
|
|
200
192
|
console.warn(`${hmrPrefix}Cannot apply update.`);
|
|
201
193
|
delete require.cache[require.resolve(`${paths.appBuild}/server`)];
|
|
202
194
|
// eslint-disable-next-line global-require, import/no-unresolved
|
|
203
|
-
|
|
204
|
-
const loaded = bundle instanceof Promise ? await bundle : bundle;
|
|
205
|
-
app = loaded.default;
|
|
195
|
+
app = require(`${paths.appBuild}/server`).default;
|
|
206
196
|
console.warn(`${hmrPrefix}App has been reloaded.`);
|
|
207
197
|
} else {
|
|
208
198
|
console.warn(
|
|
@@ -233,9 +223,7 @@ async function start() {
|
|
|
233
223
|
|
|
234
224
|
// Load compiled src/server.js as a middleware
|
|
235
225
|
// eslint-disable-next-line global-require, import/no-unresolved
|
|
236
|
-
|
|
237
|
-
const loaded = bundle instanceof Promise ? await bundle : bundle;
|
|
238
|
-
app = loaded.default;
|
|
226
|
+
app = require(`${paths.appBuild}/server`).default;
|
|
239
227
|
appPromiseIsResolved = true;
|
|
240
228
|
appPromiseResolve();
|
|
241
229
|
|
package/scripts/test.js
CHANGED
|
@@ -9,43 +9,32 @@ process.on('unhandledRejection', err => {
|
|
|
9
9
|
|
|
10
10
|
const jest = require('jest');
|
|
11
11
|
const path = require('path');
|
|
12
|
-
const { createRequire } = require('module');
|
|
13
12
|
|
|
14
13
|
const createJestConfig = require('../config/jest/createJestConfig');
|
|
15
14
|
const paths = require('../config/paths');
|
|
16
15
|
|
|
17
|
-
const requireApp = createRequire(`${paths.appPath}/package.json`);
|
|
18
|
-
const { loadConfig } = requireApp('c12');
|
|
19
|
-
|
|
20
16
|
require('../config/env');
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
const { config } = await loadConfig({ cwd: paths.appPath });
|
|
24
|
-
|
|
25
|
-
let argv = process.argv.slice(2);
|
|
26
|
-
|
|
27
|
-
if (argv.indexOf('--coverage') === -1 && argv.indexOf('--watchAll') === -1) {
|
|
28
|
-
argv.push('--watchAll');
|
|
29
|
-
}
|
|
18
|
+
let argv = process.argv.slice(2);
|
|
30
19
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
paths.srcPaths,
|
|
35
|
-
config
|
|
36
|
-
);
|
|
20
|
+
if (argv.indexOf('--coverage') === -1 && argv.indexOf('--watchAll') === -1) {
|
|
21
|
+
argv.push('--watchAll');
|
|
22
|
+
}
|
|
37
23
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
);
|
|
24
|
+
const jestConfig = createJestConfig(
|
|
25
|
+
relativePath => path.resolve(__dirname, '..', relativePath),
|
|
26
|
+
path.resolve(paths.appSrc, '..'),
|
|
27
|
+
paths.srcPaths
|
|
28
|
+
);
|
|
44
29
|
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
argv.push(
|
|
31
|
+
'--config',
|
|
32
|
+
JSON.stringify(
|
|
33
|
+
jestConfig
|
|
34
|
+
)
|
|
35
|
+
);
|
|
47
36
|
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
const testEnvironment = 'jsdom';
|
|
38
|
+
argv.push('--coverage', '--env', testEnvironment);
|
|
50
39
|
|
|
51
|
-
|
|
40
|
+
jest.run(argv);
|
package/scripts/utils/clean.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
const paths = require('../../config/paths');
|
|
2
|
+
const config = require('config').util.loadFileConfigs(paths.appPath + '/config');
|
|
1
3
|
const { cleanDir } = require('../lib/fs');
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Cleans up the output (build) directory.
|
|
5
7
|
*/
|
|
6
|
-
function clean(
|
|
8
|
+
function clean() {
|
|
7
9
|
return Promise.all([
|
|
8
10
|
cleanDir('build/*', {
|
|
9
11
|
nosort: true,
|
|
@@ -17,10 +17,11 @@ 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');
|
|
21
20
|
|
|
22
21
|
const paths = require('../config/paths');
|
|
23
22
|
|
|
23
|
+
const config = require('config').util.loadFileConfigs(`${paths.appPath}/config`);
|
|
24
|
+
|
|
24
25
|
const pkg = require(`${paths.appPath}/package.json`);
|
|
25
26
|
const { name, version } = pkg;
|
|
26
27
|
const topLevelFrameworkPaths = [];
|
|
@@ -55,8 +56,6 @@ const mode = isDevEnv ? 'development' : 'production';
|
|
|
55
56
|
const isRuntimeDev = DEV_SERVER === 'true';
|
|
56
57
|
const smp = new SpeedMeasurePlugin({ disable: !MEASURE });
|
|
57
58
|
|
|
58
|
-
module.exports = async (config) => {
|
|
59
|
-
|
|
60
59
|
console.log(
|
|
61
60
|
`Building webpack project ${name}@${version}\n`,
|
|
62
61
|
Object.entries({
|
|
@@ -151,9 +150,6 @@ const isModuleCSS = module => (
|
|
|
151
150
|
// -----------------------------------------------------------------------------
|
|
152
151
|
const webpackConfig = ({ isClient }) => ({
|
|
153
152
|
mode,
|
|
154
|
-
experiments: {
|
|
155
|
-
topLevelAwait: true,
|
|
156
|
-
},
|
|
157
153
|
cache: { type: 'filesystem' },
|
|
158
154
|
|
|
159
155
|
output: {
|
|
@@ -171,13 +167,9 @@ const webpackConfig = ({ isClient }) => ({
|
|
|
171
167
|
'@hooks': path.resolve(paths.appSrc, 'hooks'),
|
|
172
168
|
'@components': path.resolve(paths.appSrc, 'components'),
|
|
173
169
|
'@baseComponents': path.resolve(paths.appSrc, 'base_components'),
|
|
174
|
-
'react/jsx-runtime':
|
|
175
|
-
'react/jsx-
|
|
176
|
-
'react/jsx-runtime.js': require.resolve('react/jsx-runtime'),
|
|
177
|
-
'react/jsx-dev-runtime.js': require.resolve('react/jsx-dev-runtime'),
|
|
178
|
-
...(isClient ? { c12: false } : {}),
|
|
170
|
+
'react/jsx-dev-runtime': 'react/jsx-dev-runtime.js',
|
|
171
|
+
'react/jsx-runtime': 'react/jsx-runtime.js'
|
|
179
172
|
},
|
|
180
|
-
conditionNames: ['import', 'require', 'node', 'default'],
|
|
181
173
|
},
|
|
182
174
|
|
|
183
175
|
resolveLoader: {
|
|
@@ -202,7 +194,6 @@ const webpackConfig = ({ isClient }) => ({
|
|
|
202
194
|
babelrc: false,
|
|
203
195
|
configFile: false,
|
|
204
196
|
compact: isProdEnv,
|
|
205
|
-
isClient,
|
|
206
197
|
cacheDirectory: true,
|
|
207
198
|
cacheCompression: false,
|
|
208
199
|
customize: path.resolve(__dirname, '../config/babel/babel-custom-loader.js'),
|
|
@@ -216,9 +207,6 @@ const webpackConfig = ({ isClient }) => ({
|
|
|
216
207
|
test: /\.mjs$/,
|
|
217
208
|
include: /node_modules/,
|
|
218
209
|
type: 'javascript/auto',
|
|
219
|
-
resolve: {
|
|
220
|
-
fullySpecified: false,
|
|
221
|
-
}
|
|
222
210
|
},
|
|
223
211
|
{
|
|
224
212
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
@@ -313,6 +301,8 @@ const styleLoaders = ({ isClient }) => [
|
|
|
313
301
|
root: `${paths.appSrc}/styles/`
|
|
314
302
|
}
|
|
315
303
|
],
|
|
304
|
+
'tailwindcss/nesting',
|
|
305
|
+
'tailwindcss',
|
|
316
306
|
[
|
|
317
307
|
'postcss-preset-env',
|
|
318
308
|
{
|
|
@@ -323,7 +313,6 @@ const styleLoaders = ({ isClient }) => [
|
|
|
323
313
|
browsers: pkg.browserslist
|
|
324
314
|
}
|
|
325
315
|
],
|
|
326
|
-
'tailwindcss',
|
|
327
316
|
'postcss-modules-values',
|
|
328
317
|
'postcss-flexbugs-fixes'
|
|
329
318
|
],
|
|
@@ -483,7 +472,6 @@ const clientConfig = {
|
|
|
483
472
|
https: false,
|
|
484
473
|
util: false,
|
|
485
474
|
buffer: false,
|
|
486
|
-
assert: false,
|
|
487
475
|
}
|
|
488
476
|
},
|
|
489
477
|
module: {
|
|
@@ -520,6 +508,8 @@ const clientConfig = {
|
|
|
520
508
|
root: `${paths.appSrc}/styles/`
|
|
521
509
|
}
|
|
522
510
|
],
|
|
511
|
+
'tailwindcss/nesting',
|
|
512
|
+
'tailwindcss',
|
|
523
513
|
[
|
|
524
514
|
'postcss-preset-env',
|
|
525
515
|
{
|
|
@@ -528,7 +518,6 @@ const clientConfig = {
|
|
|
528
518
|
browsers: pkg.browserslist,
|
|
529
519
|
}
|
|
530
520
|
],
|
|
531
|
-
'tailwindcss',
|
|
532
521
|
'postcss-modules-values',
|
|
533
522
|
'postcss-flexbugs-fixes',
|
|
534
523
|
],
|
|
@@ -564,9 +553,6 @@ const clientConfig = {
|
|
|
564
553
|
extensions: ['less'],
|
|
565
554
|
exclude: ['node_modules', 'coverage'],
|
|
566
555
|
}),
|
|
567
|
-
isRuntimeDev && new ReactRefreshWebpackPlugin({
|
|
568
|
-
overlay: false,
|
|
569
|
-
}),
|
|
570
556
|
new webpack.HotModuleReplacementPlugin(),
|
|
571
557
|
new SubresourceIntegrityPlugin(),
|
|
572
558
|
new LoadablePlugin({
|
|
@@ -578,14 +564,12 @@ const clientConfig = {
|
|
|
578
564
|
// Define free variables
|
|
579
565
|
// https://webpack.github.io/docs/list-of-plugins.html#defineplugin
|
|
580
566
|
new webpack.DefinePlugin({
|
|
567
|
+
CONFIG: JSON.stringify(config.globals),
|
|
581
568
|
'process.env.DEV_SERVER': isRuntimeDev,
|
|
582
569
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
583
570
|
'process.env.BROWSER': true,
|
|
584
571
|
__DEVTOOLS__: isVerbose // <-------- DISABLE redux-devtools HERE
|
|
585
572
|
}),
|
|
586
|
-
new webpack.ProvidePlugin({
|
|
587
|
-
process: 'process/browser.js',
|
|
588
|
-
}),
|
|
589
573
|
|
|
590
574
|
new MiniCssExtractPlugin({
|
|
591
575
|
// Options similar to the same options in webpackOptions.output
|
|
@@ -760,6 +744,7 @@ const serverConfig = {
|
|
|
760
744
|
// Define free variables
|
|
761
745
|
// https://webpack.github.io/docs/list-of-plugins.html#defineplugin
|
|
762
746
|
new webpack.DefinePlugin({
|
|
747
|
+
CONFIG: JSON.stringify(config.globals),
|
|
763
748
|
'process.env.DEV_SERVER': isRuntimeDev,
|
|
764
749
|
'process.env.BROWSER': false,
|
|
765
750
|
__DEVTOOLS__: false // <-------- DISABLE redux-devtools HERE
|
|
@@ -778,5 +763,4 @@ const serverConfig = {
|
|
|
778
763
|
|
|
779
764
|
let configs = smp.wrap([clientConfig, serverConfig]);
|
|
780
765
|
|
|
781
|
-
|
|
782
|
-
};
|
|
766
|
+
module.exports = configs;
|