rich-filemanager,elfinder-无法解析

问题描述 投票:0回答:1

[当我在Svelte / Sapper中使用这些库并使用await import('rich-filemanager')(在onMount函数中)时,出现错误:'rich-filemanager' is imported by src/routes/disky.svelte, but could not be resolved – treating it as an external dependency与elfinder和其他几个相同,...我已经正确安装了这些库,并且使用了用于工单的rollUP模板。

我的src / routes / disky.svelte中的Javascript代码:

import { onMount } from 'svelte'

onMount(async () => {
    const jQuery = await import('jquery')
    //const bootstrap = await import('bootstrap')
    //const elfinder = await import('elfinder')
    const richFilemanager = await import('rich-filemanager')

    console.log(richFilemanager)

    /*jQuery('.fm-container').richFilemanager({
        baseUrl: 'http://localhost:8080/filemanager'

        // options for the plugin initialization step and callback functions, see:

        // https://github.com/servocoder/RichFilemanager/wiki/Configuration-options#plugin-parameters

    })(jQuery);*/
})

E:好的,我解决了导入问题..

    const richFilemanager = await import('rich-filemanager/src/js/filemanager.min.js')

工作正常,但仍然出现错误:未捕获(按承诺)ReferenceError:jQuery未定义在filemanager.min.js:3

E2:解决了jQuery错误,现在我得到了Uncaught (in promise) TypeError: Cannot add property richFilemanagerPlugin, object is not extensible

我的实际代码:

import { onMount } from 'svelte'

onMount(async () => {
    const jquery = await import('jquery');
    window.jQuery = jquery;

    const richFilemanager = await import('rich-filemanager/src/js/filemanager.min.js');

    jquery('.fm-container').richFilemanager({
        baseUrl: 'http://localhost:8080/filemanager'
    });
})

[当我在Svelte / Sapper中使用这些库并使用await import('rich-filemanager')(在onMount func中)时出现错误:'rich-filemanager'由src / routes / disky.svelte导入,但无法解决...

import svelte rollupjs elfinder sapper
1个回答
0
投票

尝试通过使用将jQuery暴露给全局对象

© www.soinside.com 2019 - 2024. All rights reserved.