Using required modules in Browserify Diffrently

66 Views Asked by At

First I bundled my main.js file with bundle.js

my main.js:

const Uppy = require('@uppy/core');
const XHRUpload = require('@uppy/xhr-upload');
const Dashboard = require('@uppy/dashboard');
const Webcam = require('@uppy/webcam');
const ImageEditor = require('@uppy/image-editor')

const uppy = new Uppy({
    id: 'uppy',
    autoProceed: false,
    restrictions: {
        maxFileSize: null,
        minFileSize: null,
        maxTotalFileSize: null,
        maxNumberOfFiles: null,
        minNumberOfFiles: null,
        allowedFileTypes: null
      }
     
}).use(Dashboard,{
    inline: true,
    target:'#drag-drop-area',
    width: 700,
    height: 400,
   
})
.use(XHRUpload,{
    endpoint: 'http://localhost:3000/image',
    fieldName:'photo',
    formData: true
})
.use(Webcam,{target:Dashboard})
.use(ImageEditor, {
    target: Dashboard,
    quality: 0.8
  });

Now I want this part from my main.js file to be different for different pages in my website (for example endpoints,maxsFileSize etc) :-

const uppy = new Uppy({
    id: 'uppy',
    autoProceed: false,
    restrictions: {
        maxFileSize: null,
        minFileSize: null,
        maxTotalFileSize: null,
        maxNumberOfFiles: null,
        minNumberOfFiles: null,
        allowedFileTypes: null
      }
     
}).use(Dashboard,{
    inline: true,
    target:'#drag-drop-area',
    width: 700,
    height: 400,
   
})
.use(XHRUpload,{
    endpoint: 'http://localhost:3000/image',
    fieldName:'photo',
    formData: true
})
.use(Webcam,{target:Dashboard})
.use(ImageEditor, {
    target: Dashboard,
    quality: 0.8
  });

console.log('puuppy');

How do I do that. Please help..!! I read about --standalone but didn't how to apply it to my problem

0

There are 0 best solutions below