@plaudit/webpack-extensions 2.36.0 → 2.37.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.
@@ -73,6 +73,7 @@ class BlockJSONManagingPlugin {
73
73
  }
74
74
  }
75
75
  }
76
+ //TODO: Fix modules support when running in non-dev mode
76
77
  const blockDirConfigData = {};
77
78
  for (const [name, sourceDir] of currentBlockJSONAssets) {
78
79
  const assetContents = this.processingModules ? node_fs_1.default.readFileSync(testableCompilationAssets[name], 'utf8') : compilation.assets[name]?.buffer().toString();
@@ -0,0 +1,4 @@
1
+ import type { Compiler, WebpackPluginInstance } from "webpack";
2
+ export default class MiniCSSExtractPluginErrorCleaner implements WebpackPluginInstance {
3
+ apply(compiler: Compiler): void;
4
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class MiniCSSExtractPluginErrorCleaner {
4
+ apply(compiler) {
5
+ compiler.hooks.done.tap("CleanupMiniCssExtractPlugin", stats => {
6
+ if (stats.hasErrors()) {
7
+ if (!stats.compilation.errors.every(error => error.message.includes("mini-css-extract-plugin")) && stats.compilation.errors.length % 2 === 0) {
8
+ stats.compilation.errors = stats.compilation.errors.filter(error => !error.message.includes("mini-css-extract-plugin"));
9
+ }
10
+ }
11
+ });
12
+ }
13
+ }
14
+ exports.default = MiniCSSExtractPluginErrorCleaner;
@@ -7,6 +7,7 @@ const node_path_1 = __importDefault(require("node:path"));
7
7
  const AdditionalDependencyInjectorPlugin_1 = __importDefault(require("./wordpress-scripts-wrapper/AdditionalDependencyInjectorPlugin"));
8
8
  const BlockJSONManagingPlugin_1 = __importDefault(require("./wordpress-scripts-wrapper/BlockJSONManagingPlugin"));
9
9
  const ExtensionsConfigFileGeneratorPlugin_1 = __importDefault(require("./wordpress-scripts-wrapper/ExtensionsConfigFileGeneratorPlugin"));
10
+ const MiniCSSExtractPluginErrorCleaner_1 = __importDefault(require("./wordpress-scripts-wrapper/MiniCSSExtractPluginErrorCleaner"));
10
11
  const VariablesJSMonitorPlugin_1 = __importDefault(require("./wordpress-scripts-wrapper/VariablesJSMonitorPlugin"));
11
12
  const BrowserSyncPlugin_1 = require("./wordpress-scripts-wrapper/BrowserSyncPlugin");
12
13
  const static_configs_1 = require("./wordpress-scripts-wrapper/static-configs");
@@ -17,9 +18,6 @@ const webpack_remove_empty_scripts_1 = __importDefault(require("webpack-remove-e
17
18
  function joinPossiblyAbsolutePaths(...paths) {
18
19
  return paths.reduce((res, p) => !res || node_path_1.default.isAbsolute(p) ? p : node_path_1.default.join(res, p), '') || '.';
19
20
  }
20
- function test(content, map, meta) {
21
- this.resourcePath;
22
- }
23
21
  function mapToRealEntrypoints(entrypoint, dir, mapper = (entrypoint) => entrypoint, lazyDependent) {
24
22
  return (Array.isArray(entrypoint) ? entrypoint : [entrypoint])
25
23
  .map(ep => joinPossiblyAbsolutePaths(dir, mapper(ep)))
@@ -342,7 +340,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources) {
342
340
  plugins.push(new webpack_remove_empty_scripts_1.default({
343
341
  stage: webpack_remove_empty_scripts_1.default.STAGE_AFTER_PROCESS_PLUGINS,
344
342
  extensions: ['css', 'scss', 'sass', 'less', 'styl', 'pcss']
345
- }));
343
+ }), new MiniCSSExtractPluginErrorCleaner_1.default());
346
344
  if (variablesFilePath) {
347
345
  plugins.push(new VariablesJSMonitorPlugin_1.default(variablesFilePath));
348
346
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.36.0",
3
+ "version": "2.37.0",
4
4
  "license": "UNLICENSED",
5
5
  "scripts": {
6
6
  "prepublishOnly": "rm -rf build && mkdir build && tsc",