@lipemat/js-boilerplate 9.2.0-beta.9 → 10.0.0-beta.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/config/babel.config.js +4 -2
- package/config/css-loader.config.js +17 -15
- package/config/webpack.dev.js +5 -5
- package/config/webpack.dist.js +0 -2
- package/package.json +6 -6
package/config/babel.config.js
CHANGED
|
@@ -19,11 +19,13 @@ module.exports = {
|
|
|
19
19
|
cacheDirectory: true,
|
|
20
20
|
presets: [
|
|
21
21
|
[ '@babel/preset-env', presetEnv ],
|
|
22
|
-
'@babel/preset-react',
|
|
22
|
+
[ '@babel/preset-react', {
|
|
23
|
+
development: 'production' !== process.env.NODE_ENV,
|
|
24
|
+
runtime: 'automatic',
|
|
25
|
+
} ],
|
|
23
26
|
'@babel/preset-typescript',
|
|
24
27
|
],
|
|
25
28
|
plugins: [
|
|
26
29
|
'@babel/plugin-syntax-dynamic-import',
|
|
27
|
-
'react-hot-loader/babel',
|
|
28
30
|
],
|
|
29
31
|
};
|
|
@@ -5,25 +5,30 @@ const {getLocalIdent} = require( '../helpers/css-classnames' );
|
|
|
5
5
|
* Options for the Webpack `css-loader`.
|
|
6
6
|
*
|
|
7
7
|
* Extracted to its on file to allow easy overrides.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Default to :global for classes in "global" or "pcss" directories.
|
|
8
12
|
*
|
|
9
|
-
* @
|
|
13
|
+
* @param {string} resourcePath
|
|
14
|
+
* @return {string}
|
|
10
15
|
*/
|
|
16
|
+
const mode = resourcePath => {
|
|
17
|
+
if ( /globals?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ) {
|
|
18
|
+
return 'global';
|
|
19
|
+
}
|
|
20
|
+
if ( /pcss?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ) {
|
|
21
|
+
return 'global';
|
|
22
|
+
}
|
|
23
|
+
return 'local';
|
|
24
|
+
};
|
|
11
25
|
|
|
12
26
|
let cssLoader = {
|
|
13
27
|
importLoaders: 1,
|
|
14
28
|
modules: {
|
|
15
29
|
exportLocalsConvention: 'camelCase',
|
|
16
30
|
localIdentName: 'Ⓜ[name]__[local]__[contenthash:base64:2]',
|
|
17
|
-
|
|
18
|
-
mode: resourcePath => {
|
|
19
|
-
if ( /globals?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ) {
|
|
20
|
-
return 'global';
|
|
21
|
-
}
|
|
22
|
-
if ( /pcss?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ) {
|
|
23
|
-
return 'global';
|
|
24
|
-
}
|
|
25
|
-
return 'local';
|
|
26
|
-
},
|
|
31
|
+
mode,
|
|
27
32
|
},
|
|
28
33
|
sourceMap: true,
|
|
29
34
|
url: false,
|
|
@@ -38,10 +43,7 @@ if ( 'production' === process.env.NODE_ENV ) {
|
|
|
38
43
|
...config.shortCssClasses ? {getLocalIdent} : {},
|
|
39
44
|
// Hash used when short CSS classes are not enabled.
|
|
40
45
|
localIdentName: '[contenthash:base64:5]',
|
|
41
|
-
|
|
42
|
-
mode: resourcePath => {
|
|
43
|
-
return /globals?\//i.test( resourcePath.replace( /\\/g, '/' ) ) ? 'global' : 'local';
|
|
44
|
-
},
|
|
46
|
+
mode,
|
|
45
47
|
},
|
|
46
48
|
url: false,
|
|
47
49
|
};
|
package/config/webpack.dev.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const {getConfig, hasLocalOverride} = require( '../helpers/config' );
|
|
2
1
|
const webpack = require( 'webpack' );
|
|
2
|
+
const ReactRefreshWebpackPlugin = require( '@pmmmwh/react-refresh-webpack-plugin' );
|
|
3
3
|
const path = require( 'path' );
|
|
4
4
|
const ForkTsCheckerWebpackPlugin = require( 'fork-ts-checker-webpack-plugin' );
|
|
5
5
|
const config = require( '../helpers/package-config' );
|
|
6
6
|
const {getEntries} = require( '../helpers/entries' );
|
|
7
|
+
const {getConfig, hasLocalOverride} = require( '../helpers/config' );
|
|
7
8
|
|
|
8
9
|
const postcssOptions = getConfig( 'postcss.config.js' );
|
|
9
10
|
const babelOptions = getConfig( 'babel.config.js' );
|
|
@@ -12,12 +13,15 @@ const devServerOptions = getConfig( 'dev-server.config.js' );
|
|
|
12
13
|
|
|
13
14
|
// To allow line numbers to show up in console errors. @see React Error Boundaries.
|
|
14
15
|
babelOptions.plugins.unshift( '@babel/plugin-transform-react-jsx-source' );
|
|
16
|
+
// To support React Fast Refresh.
|
|
17
|
+
babelOptions.plugins.unshift( 'react-refresh/babel' );
|
|
15
18
|
|
|
16
19
|
const plugins = [
|
|
17
20
|
new webpack.ProvidePlugin( {
|
|
18
21
|
jQuery: 'jquery',
|
|
19
22
|
$: 'jquery',
|
|
20
23
|
} ),
|
|
24
|
+
new ReactRefreshWebpackPlugin(),
|
|
21
25
|
];
|
|
22
26
|
|
|
23
27
|
// Loads a thread, which verifies any TypeScripts on changes.
|
|
@@ -47,9 +51,6 @@ module.exports = {
|
|
|
47
51
|
chunkFilename: '[name].js',
|
|
48
52
|
},
|
|
49
53
|
resolve: {
|
|
50
|
-
alias: {
|
|
51
|
-
'react-dom': '@hot-loader/react-dom',
|
|
52
|
-
},
|
|
53
54
|
extensions: [ '.ts', '.tsx', '.js', '.jsx', '.json', '.pcss' ],
|
|
54
55
|
modules: [
|
|
55
56
|
path.resolve( config.workingDirectory, 'src' ),
|
|
@@ -73,7 +74,6 @@ module.exports = {
|
|
|
73
74
|
{
|
|
74
75
|
test: /\.[jt]sx?$/,
|
|
75
76
|
include: /node_modules/,
|
|
76
|
-
use: [ 'react-hot-loader/webpack' ],
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
test: /\.css$/,
|
package/config/webpack.dist.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const webpack = require( 'webpack' );
|
|
2
2
|
const path = require( 'path' );
|
|
3
|
-
require( 'node:crypto' );
|
|
4
3
|
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
|
|
5
4
|
const {CleanWebpackPlugin} = require( 'clean-webpack-plugin' );
|
|
6
5
|
const WebpackAssetsManifest = require( 'webpack-assets-manifest' );
|
|
@@ -119,7 +118,6 @@ module.exports = {
|
|
|
119
118
|
},
|
|
120
119
|
],
|
|
121
120
|
},
|
|
122
|
-
|
|
123
121
|
],
|
|
124
122
|
},
|
|
125
123
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lipemat/js-boilerplate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-beta.1",
|
|
4
4
|
"description": "Dependencies and scripts for a no config JavaScript app",
|
|
5
5
|
"author": "Mat Lipe",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"@babel/preset-env": "^7.12.11",
|
|
43
43
|
"@babel/preset-react": "^7.12.10",
|
|
44
44
|
"@babel/preset-typescript": "^7.12.7",
|
|
45
|
-
"@hot-loader/react-dom": "^17.0.1",
|
|
46
45
|
"@lipemat/css-mqpacker": "^9.0.0",
|
|
47
46
|
"@lipemat/eslint-config": "^2.0.1",
|
|
47
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
48
48
|
"@types/lipemat__js-boilerplate": "lipemat/types-js-boilerplate#semver:^1.3.0",
|
|
49
49
|
"@wordpress/browserslist-config": "^4.1.0",
|
|
50
50
|
"are-you-es5": "^2.1.1",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"postcss-nested": "^5.0.6",
|
|
73
73
|
"postcss-preset-env": "^7.5.0",
|
|
74
74
|
"postcss-scss": "^4.0.4",
|
|
75
|
-
"react": "^
|
|
76
|
-
"react-dom": "^
|
|
77
|
-
"react-
|
|
75
|
+
"react": "^18.2.0",
|
|
76
|
+
"react-dom": "^18.2.0",
|
|
77
|
+
"react-refresh": "^0.14.0",
|
|
78
78
|
"style-loader": "^3.3.1",
|
|
79
79
|
"typescript": "^4.2.4",
|
|
80
80
|
"update-notifier": "^4.1.3",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"webpack-dev-server": "^4.7.2",
|
|
85
85
|
"webpack-subresource-integrity": "^5.1.0"
|
|
86
86
|
},
|
|
87
|
-
"packageManager": "yarn@3.
|
|
87
|
+
"packageManager": "yarn@3.5.0"
|
|
88
88
|
}
|