'NPM modules with Sails.js, and more specifically: using Dropzone.js with Sails.js
I've been using Sails.js for a year or so off and on, but when it comes to adding an NPM module I'm a bit confused. Specifically, I'm trying to use Dropzone with Sails for multi-file uploading and am having quite a bit of trouble figuring out how to go about the whole thing. I've installed via npm install --save dropzone and I'm stuck on what do now.
For example, Dropzone's documentation has the following:
// If you are using JavaScript/ECMAScript modules:
import Dropzone from "dropzone";
// If you are using CommonJS modules:
const { Dropzone } = require("dropzone");
let myDropzone = new Dropzone("#my-form");
myDropzone.on("addedfile", file => {
console.log(`File added: ${file.name}`);
});
I'm assuming I'd be using the CommonJS module method, but I cannot figure out where to put it and get the Dropzone constructor to be recognized.
Any ideas?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
