question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

From a newbie. I want to know where to put the snippet which as following:

const Uppy = require('@uppy/core')
const Dashboard = require('@uppy/dashboard')
const GoogleDrive = require('@uppy/google-drive')
const Dropbox = require('@uppy/dropbox')
const Instagram = require('@uppy/instagram')
const Facebook = require('@uppy/facebook')
const OneDrive = require('@uppy/onedrive')
const Webcam = require('@uppy/webcam')
const ScreenCapture = require('@uppy/screen-capture')
const ImageEditor = require('@uppy/image-editor')
const Tus = require('@uppy/tus')

const uppy = new Uppy({
  debug: true,
  autoProceed: false,
  restrictions: {
    maxFileSize: 1000000,
    maxNumberOfFiles: 3,
    minNumberOfFiles: 2,
    allowedFileTypes: ['image/*', 'video/*']
  }
})
.use(Dashboard, {
  trigger: '.UppyModalOpenerBtn',
  inline: true,
  target: '.DashboardContainer',
  replaceTargetContent: true,
  showProgressDetails: true,
  note: 'Images and video only, 2–3 files, up to 1 MB',
  height: 470,
  metaFields: [
    { id: 'name', name: 'Name', placeholder: 'file name' },
    { id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
  ],
  browserBackButtonClose: false
})
.use(GoogleDrive, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Dropbox, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Instagram, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Facebook, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(OneDrive, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Webcam, { target: Dashboard })
.use(ScreenCapture, { target: Dashboard })
.use(ImageEditor, { target: Dashboard })
.use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' })

uppy.on('complete', result => {
  console.log('successful files:', result.successful)
  console.log('failed files:', result.failed)
})

It seems that bundling is neccessary, and I try to bundle the modules by webpack, but it fails. Any one can show the steps exactly? Thanks very very much!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
turtlekeycommented, Feb 25, 2021

@goto-bus-stop Great!!! Thanks very[* 10] much 💯

0reactions
goto-bus-stopcommented, Feb 25, 2021

The Uppy.Webcam, Uppy.Dashboard names for plugins are only available on the CDN. Since you’re using the npm packages directly, you have to use the variables you imported:

const Webcam = require('@uppy/webcam')
uppy.use(Webcam)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle errors thrown by require() module in node.js
having a bit of a snag in my code when trying to require() modules that don't exists. The code loops through a directory...
Read more >
Common Errors - RequireJS
This page lists errors that are generated by RequireJS. ... If the error message includes Use require([]), then it was a top-level require...
Read more >
How to fix the error `require is not defined` in Node.js
Today I started writing a new project on Node.js and got this error on the very first run: const express = require('express'); ...
Read more >
require - Go Packages
Package require implements the same assertions as the `assert` package but stops test execution when a test fails.
Read more >
Error: Log Inspection Rules Require Log Files | Deep Security
Click on the Log Inspection Rules Require Log Files error. · In the Deep Security Manager, go to Policies > Common Objects >...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found