Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

Commit bef19f2

Browse files
author
Eimantas Dumšė
authored
Fixed images. (#36)
* Fixed issued when images disappear after everyn 2nd build. * Deleted unused import. * Added missing new tests. * Updated tests and string. * Updated exports.
1 parent 5045c0e commit bef19f2

8 files changed

Lines changed: 9 additions & 24 deletions

File tree

packages/image-loader/src/image-loader.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { loader } from "webpack";
2-
import fs from "fs-extra";
32
// Utils
43
import { getOptions, interpolateName, parseQuery, OptionObject, getHashDigest } from "loader-utils";
54
import validateOptions from "schema-utils";
@@ -199,19 +198,7 @@ class ImageLoader {
199198
content: contentBuffer
200199
});
201200

202-
const path = `__webpack_public_path__ + ${JSON.stringify(url)}`;
203-
204-
// If 'optimizeImagesInDev' value set to 'true' then every build check if files(images) exists in output dir is skipped.
205-
if (!options.optimizeImagesInDev) {
206-
const replacedOutputPath: string = this._compiler.options.output.path.replace(/\\/g, "/");
207-
const existentFilePath = `${replacedOutputPath}/${url}`;
208-
if (fs.existsSync(existentFilePath)) {
209-
const fileContent = fs.readFileSync(existentFilePath);
210-
ReactwayImageLoaderPlugin.imagesSizeArray.push({ ...imageSizeData, reducedSize: fileContent });
211-
212-
return `module.exports = {src: ${path},toString:function(){return ${path}}};`;
213-
}
214-
}
201+
const path = "__webpack_public_path__ + " + JSON.stringify(url);
215202

216203
if (query != null) {
217204
try {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import { CleanPlugin } from "./plugin";
2-
export = CleanPlugin;
1+
export * from "./plugin";
2+
export * from "./plugin-options";
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
import { HtmlPlugin } from "./plugin";
2-
export = HtmlPlugin;
1+
export * from "./plugin";
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
import { ImagesPlugin } from "./plugin";
2-
export = ImagesPlugin;
1+
export * from "./plugin";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from "./plugin";
22
export * from "./plugin-options";
3+
export * from "./checkers";
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
import { WebDevPlugin } from "./plugin";
2-
export = WebDevPlugin;
1+
export * from "./plugin";
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
import { WriteFilePlugin } from "./plugin";
2-
export = WriteFilePlugin;
1+
export * from "./plugin";

0 commit comments

Comments
 (0)