`ReferenceError: require is not defined
Module../node_modules/minio/node_modules/async/dist/async.mjs
http://localhost/static/js/0.chunk.js:215453:30
__webpack_require__
src/app/webpack/bootstrap:782
779 | };
780 |
781 | // Execute the module function
782 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 783 |
784 | // Flag the module as loaded
785 | module.l = true;
View compiled
fn
src/app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
150 | return webpack_require(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
▶ 2 stack frames were collapsed.
webpack_require
src/app/webpack/bootstrap:782
779 | };
780 |
781 | // Execute the module function
782 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 783 |
784 | // Flag the module as loaded
785 | module.l = true;
View compiled
fn
src/app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
150 | return webpack_require(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
▶ 2 stack frames were collapsed.
webpack_require
src/app/webpack/bootstrap:782
779 | };
780 |
781 | // Execute the module function
782 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 783 |
784 | // Flag the module as loaded
785 | module.l = true;`
To Reproduce
I have created several files and made most changes in minioStorage.ts by replacing the functions similar to azureStorage.ts with minio API
Expected behavior
A clear and concise description of what you expected to happen. A sample of the code listed below:
`import { IStorageProvider } from "./storageProviderFactory";
import { IAsset, AssetType, StorageType } from "../../models/applicationState";
import { AssetService } from "../../services/assetService";
import * as minio from "minio";
import { Bounce } from "react-toastify";
Describe the bug I am adding a new cloud storage support by using min.io (https://docs.min.io/docs/javascript-client-api-reference.html). After running npm start, no particular error. When I go to http://localhost, received the following error:
`ReferenceError: require is not defined Module../node_modules/minio/node_modules/async/dist/async.mjs http://localhost/static/js/0.chunk.js:215453:30 __webpack_require__ src/app/webpack/bootstrap:782 779 | }; 780 | 781 | // Execute the module function
To Reproduce I have created several files and made most changes in minioStorage.ts by replacing the functions similar to azureStorage.ts with minio API
Expected behavior A clear and concise description of what you expected to happen. A sample of the code listed below:
`import { IStorageProvider } from "./storageProviderFactory"; import { IAsset, AssetType, StorageType } from "../../models/applicationState"; import { AssetService } from "../../services/assetService"; import * as minio from "minio"; import { Bounce } from "react-toastify";
//var minio = require("minio");
const minioClient = new minio.Client({ endPoint: "localhost", port: 9000, useSSL: false, accessKey: "xxxx", secretKey: "xxxxxxx" });
/**
export class MinioStorage implements IStorageProvider { /**
@returns - StorageType.Cloud */ public storageType: StorageType = StorageType.Cloud;
constructor(private options?: IMinioStorageOptions) {}
/**
createBucket
was specified in options, this functionconnect to Minio Storage */ public async initialize(): Promise {
const bucketName = this.options.folderName;
if (this.options.createFolder) {
await this.createContainer(bucketName);
} else {
const containers = await this.listFiles(bucketName);
if (containers.length === 0) {
throw new Error(
Container "${bucketName}" does not exist
); } } }/**
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context Add any other context about the problem here.
Any hint is welcome! Thanks.