Javascript ResumableJs不使用Webpack/Webpackencore
我已经用Thread安装了Resumablejs,我在node_模块文件夹中看到了它 Webpack.config.js package.json app.js EntriesJs 在我的app.js中,我声明它Javascript ResumableJs不使用Webpack/Webpackencore,javascript,symfony,webpack,webpack-encore,resumablejs,Javascript,Symfony,Webpack,Webpack Encore,Resumablejs,我已经用Thread安装了Resumablejs,我在node_模块文件夹中看到了它 Webpack.config.js package.json app.js EntriesJs 在我的app.js中,我声明它require('resumablejs')然后在我的文件中,我想这样使用它: module.exports = function (uploadJs) { return filesUploadScript(); }; function filesUploadScript()
require('resumablejs')代码>然后在我的文件中,我想这样使用它:
module.exports = function (uploadJs) {
return filesUploadScript();
};
function filesUploadScript() {
(function () {
console.log('js loaded...');
var uploaderWidgetProperties = $('#_f-uploader-widget-properties');
var r = new Resumable({ ... });
但在这一点上,我得到了以下错误:
Uncaught ReferenceError:未定义可恢复性
我很难理解这个网页,所以任何帮助都会很好。您是如何导入它的?你能把包含require('resumablejs')的整行内容都贴出来吗
文件在哪里,您在哪里尝试使用它,它是哪个文件-文件导入正确吗?@Domagoj如果有帮助,我已经添加了更多详细信息
"dependencies": {
...
"resumablejs": "^1.1.0",
...
}
/*
* Welcome to your app's main JavaScript file!
*
* We recommend including the built version of this JavaScript file
* (and its CSS file) in your base layout (base.html.twig).
*/
// any CSS you require will output into a single css file (app.css in this case)
require('../css/app.scss');
const $ = require('jquery');
global.$ = global.jQuery = $;
require('resumablejs');
...
import './EntriesJs';
import AppScripts from './js/appScripts';
export {
AppScripts
}
module.exports = function (uploadJs) {
return filesUploadScript();
};
function filesUploadScript() {
(function () {
console.log('js loaded...');
var uploaderWidgetProperties = $('#_f-uploader-widget-properties');
var r = new Resumable({ ... });