@merkur/tool-webpack 0.27.1 โ 0.28.0
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/CHANGELOG.md +40 -0
- package/index.cjs +4 -2
- package/module/babelLoader.cjs +4 -2
- package/module/styleLoader.cjs +4 -3
- package/package.json +23 -21
- package/webpack/cache.cjs +1 -1
- package/webpack/liveReloadServer.cjs +0 -20
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,46 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.28.0](https://github.com/mjancarik/merkur/compare/v0.27.6...v0.28.0) (2022-04-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Code Refactoring
|
|
10
|
+
|
|
11
|
+
* ๐ก move liveReloadServer to merkur/tools ([f81e0e8](https://github.com/mjancarik/merkur/commit/f81e0e89eff4a72985c89d23079be6a9344a3b2e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* ๐งจ The liveReloadServer.cjs file is moved to @merkur/tools. The
|
|
17
|
+
@merkur/tool-webpack re-export createLiveReloadServer for keeping
|
|
18
|
+
backward compatability.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [0.27.4](https://github.com/mjancarik/merkur/compare/v0.27.3...v0.27.4) (2021-10-06)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* ๐ธ Allow CssMinimizerPlugin options override ([#114](https://github.com/mjancarik/merkur/issues/114)) ([c02dd0b](https://github.com/mjancarik/merkur/commit/c02dd0bf06a44bbf45880c9b1932a33e287f35ce))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## [0.27.3](https://github.com/mjancarik/merkur/compare/v0.27.2...v0.27.3) (2021-10-04)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* ๐ Windows babel es5 build issue with exclude pattern ([#113](https://github.com/mjancarik/merkur/issues/113)) ([26387ea](https://github.com/mjancarik/merkur/commit/26387ea01d840d5d6f55d4748d34c87c7f3f5f10))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
6
46
|
## [0.27.1](https://github.com/mjancarik/merkur/compare/v0.27.0...v0.27.1) (2021-09-30)
|
|
7
47
|
|
|
8
48
|
**Note:** Version bump only for package @merkur/tool-webpack
|
package/index.cjs
CHANGED
|
@@ -9,7 +9,9 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
|
9
9
|
const CompressionPlugin = require('compression-webpack-plugin');
|
|
10
10
|
|
|
11
11
|
const { createCache, createCacheKey } = require('./webpack/cache.cjs');
|
|
12
|
-
const {
|
|
12
|
+
const {
|
|
13
|
+
createLiveReloadServer,
|
|
14
|
+
} = require('@merkur/tools/liveReloadServer.cjs');
|
|
13
15
|
const { applyBundleAnalyzer } = require('./module/bundleAnalyzer.cjs');
|
|
14
16
|
const {
|
|
15
17
|
findLoaders,
|
|
@@ -168,7 +170,7 @@ function createWebConfig(config, context) {
|
|
|
168
170
|
module: {
|
|
169
171
|
...baseConfig?.module,
|
|
170
172
|
rules: [
|
|
171
|
-
...baseConfig?.module?.rules,
|
|
173
|
+
...(baseConfig?.module?.rules ?? []),
|
|
172
174
|
{
|
|
173
175
|
test: /\.m?js/,
|
|
174
176
|
resolve: {
|
package/module/babelLoader.cjs
CHANGED
|
@@ -123,7 +123,9 @@ function createESTransformation(
|
|
|
123
123
|
if (babelLoaders.length === 0) {
|
|
124
124
|
config.module.rules.push({
|
|
125
125
|
test: /\.(js|ts|tsx|mjs|jsx)$/,
|
|
126
|
-
exclude:
|
|
126
|
+
exclude: (modulePath) =>
|
|
127
|
+
/node_modules/.test(modulePath) &&
|
|
128
|
+
!/node_modules\/(abort-controller|event-target-shim)/.test(modulePath),
|
|
127
129
|
use: {
|
|
128
130
|
loader: require.resolve('babel-loader'),
|
|
129
131
|
options: {
|
|
@@ -131,7 +133,7 @@ function createESTransformation(
|
|
|
131
133
|
cacheIdentifier: createCacheKey(
|
|
132
134
|
environment,
|
|
133
135
|
config?.name,
|
|
134
|
-
...cache?.versionDependencies
|
|
136
|
+
...(cache?.versionDependencies ?? [])
|
|
135
137
|
),
|
|
136
138
|
cacheDirectory: true,
|
|
137
139
|
cacheCompression: false,
|
package/module/styleLoader.cjs
CHANGED
|
@@ -2,7 +2,7 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
|
2
2
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
3
3
|
|
|
4
4
|
function getStyleLoaders({ isServer, isProduction }, useLess) {
|
|
5
|
-
let importLoaders = isServer;
|
|
5
|
+
let importLoaders = isServer ? 0 : 1;
|
|
6
6
|
|
|
7
7
|
if (useLess) {
|
|
8
8
|
importLoaders += 1;
|
|
@@ -29,6 +29,7 @@ function getStyleLoaders({ isServer, isProduction }, useLess) {
|
|
|
29
29
|
!isServer && {
|
|
30
30
|
loader: require.resolve('postcss-loader'),
|
|
31
31
|
options: {
|
|
32
|
+
implementation: require('postcss'),
|
|
32
33
|
postcssOptions: {
|
|
33
34
|
plugins: [
|
|
34
35
|
'postcss-flexbugs-fixes',
|
|
@@ -40,7 +41,7 @@ function getStyleLoaders({ isServer, isProduction }, useLess) {
|
|
|
40
41
|
},
|
|
41
42
|
stage: 3,
|
|
42
43
|
features: {
|
|
43
|
-
'custom-properties':
|
|
44
|
+
'custom-properties': true,
|
|
44
45
|
},
|
|
45
46
|
},
|
|
46
47
|
],
|
|
@@ -80,7 +81,7 @@ function applyStyleLoaders(config, context) {
|
|
|
80
81
|
|
|
81
82
|
config.optimization = {
|
|
82
83
|
...config.optimization,
|
|
83
|
-
minimizer: ['...', new CssMinimizerPlugin()],
|
|
84
|
+
minimizer: ['...', new CssMinimizerPlugin(plugins.CssMinimizerPlugin)],
|
|
84
85
|
};
|
|
85
86
|
|
|
86
87
|
config.plugins.push(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/tool-webpack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Merkur tool webpack.",
|
|
5
5
|
"main": "index.cjs",
|
|
6
6
|
"scripts": {
|
|
@@ -28,31 +28,33 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://merkur.js.org/",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@babel/core": "^7.
|
|
32
|
-
"@babel/preset-env": "^7.
|
|
33
|
-
"autoprefixer": "^10.
|
|
34
|
-
"babel-loader": "8.2.
|
|
31
|
+
"@babel/core": "^7.17.9",
|
|
32
|
+
"@babel/preset-env": "^7.16.11",
|
|
33
|
+
"autoprefixer": "^10.4.4",
|
|
34
|
+
"babel-loader": "8.2.4",
|
|
35
35
|
"clean-webpack-plugin": "^4.0.0",
|
|
36
|
-
"compression-webpack-plugin": "^9.
|
|
37
|
-
"core-js": "^3.
|
|
38
|
-
"css-loader": "^6.
|
|
39
|
-
"css-minimizer-webpack-plugin": "^3.
|
|
40
|
-
"find-free-port": "^2.0.0",
|
|
36
|
+
"compression-webpack-plugin": "^9.2.0",
|
|
37
|
+
"core-js": "^3.22.0",
|
|
38
|
+
"css-loader": "^6.7.1",
|
|
39
|
+
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
41
40
|
"json-loader": "0.5.7",
|
|
42
|
-
"less": "^4.1.
|
|
43
|
-
"less-loader": "^10.0
|
|
44
|
-
"mini-css-extract-plugin": "^2.
|
|
45
|
-
"postcss": "^8.
|
|
41
|
+
"less": "^4.1.2",
|
|
42
|
+
"less-loader": "^10.2.0",
|
|
43
|
+
"mini-css-extract-plugin": "^2.6.0",
|
|
44
|
+
"postcss": "^8.4.12",
|
|
46
45
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
47
|
-
"postcss-less": "^
|
|
48
|
-
"postcss-loader": "^6.
|
|
49
|
-
"postcss-preset-env": "^
|
|
50
|
-
"source-map-loader": "^3.0.
|
|
51
|
-
"webpack-bundle-analyzer": "^4.
|
|
52
|
-
"webpack-manifest-plugin": "
|
|
46
|
+
"postcss-less": "^6.0.0",
|
|
47
|
+
"postcss-loader": "^6.2.1",
|
|
48
|
+
"postcss-preset-env": "^7.4.3",
|
|
49
|
+
"source-map-loader": "^3.0.1",
|
|
50
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
|
51
|
+
"webpack-manifest-plugin": "5.0.0",
|
|
53
52
|
"webpack-modules": "1.0.0",
|
|
54
53
|
"webpack-node-externals": "3.0.0",
|
|
55
54
|
"webpack-shell-plugin-next": "^2.2.2"
|
|
56
55
|
},
|
|
57
|
-
"
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@merkur/tools": "*"
|
|
58
|
+
},
|
|
59
|
+
"gitHead": "8760a1cedbbfc37348055418bacbfc69199a3c06"
|
|
58
60
|
}
|
package/webpack/cache.cjs
CHANGED
|
@@ -16,7 +16,7 @@ function createCacheKey(...args) {
|
|
|
16
16
|
function createCache({ cwd, cache, environment }) {
|
|
17
17
|
return {
|
|
18
18
|
type: 'filesystem',
|
|
19
|
-
version: createCacheKey(environment, ...cache?.versionDependencies),
|
|
19
|
+
version: createCacheKey(environment, ...(cache?.versionDependencies ?? [])),
|
|
20
20
|
buildDependencies: {
|
|
21
21
|
defaultWebpack: ['webpack/lib/'],
|
|
22
22
|
config: [path.resolve(cwd, 'webpack.config.js')].filter(fs.existsSync),
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const fp = require('find-free-port');
|
|
2
|
-
const WebSocket = require('@merkur/tools/websocket.cjs');
|
|
3
|
-
|
|
4
|
-
async function createLiveReloadServer() {
|
|
5
|
-
if (process.env.NODE_ENV === 'development') {
|
|
6
|
-
try {
|
|
7
|
-
const [freePort] = await fp(4321);
|
|
8
|
-
process.env.MERKUR_PLAYGROUND_LIVERELOAD_PORT = freePort;
|
|
9
|
-
|
|
10
|
-
WebSocket.createServer({
|
|
11
|
-
port: freePort,
|
|
12
|
-
});
|
|
13
|
-
} catch (error) {
|
|
14
|
-
console.error(error);
|
|
15
|
-
throw new Error('Unable to retrieve free port for livereload server.');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = { createLiveReloadServer };
|