Level 14
@michaelnguyen547 Try that
export default Vapor = new Vapor(); //vapor.js
//app.js
import Vapor from './vapor';
window.Vapor = Vapor;
I want to customize vapor-js to upload file to s3 . The source file is https://github.com/laravel/vapor-js/blob/master/src/index.js
I created a resources/js/vapor.js and copy/paste vapor-js content file
In resources/js/app.js
window.Vapor = require("./vapor");
I run npm run dev, in a user/_form.blade.php, I have
window.Vapor.store(file.files[0], {
progress: progress => {
this.uploadProgress = Math.round(progress * 100);
}
}).then(response => {
});
The browser shows js errors
app.js:42752 Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
Uncaught TypeError: Cannot read property 'store' of undefined // for window.Vapor.store
I am not an js expert and have no idea how to fix this
@michaelnguyen547 Try that
export default Vapor = new Vapor(); //vapor.js
//app.js
import Vapor from './vapor';
window.Vapor = Vapor;
Please or to participate in this conversation.