未捕获的错误:define 不能在 symfony/webpack-encore 和 mdboostrap 中间接使用

问题描述

我收到错误

Uncaught Error: define cannot be used indirect
    at __webpack_require__.amdD (amd define:2)
    at mdb.lite.js:7639
    at Object.<anonymous> (mdb.lite.js:7839)
    at Object.<anonymous> (mdb.lite.js:7842)
    at n (mdb.lite.js:36)
    at Module.<anonymous> (mdb.lite.js:7848)
    at n (mdb.lite.js:36)
    at Object.<anonymous> (mdb.lite.js:7844)
    at n (mdb.lite.js:36)
    at mdb.lite.js:70

package.json

{
    "devDependencies": {
        "@fortawesome/fontawesome-free": "^5.15.3","@symfony/webpack-encore": "^1.1.2","exports-loader": "^2.0.0","expose-loader": "^2.0.0","file-loader": "^6.2.0","imports-loader": "^2.0.0","jquery": "^3.3.1","less": "^4.1.1","less-loader": "^8.0.0","sass": "^1.32.8","sass-loader": "^11.0.1","ts-loader": "^8.0.18","url-loader": "^4.1.1","webpack-notifier": "^1.6.0","jquery-validation": "1.19.3","jquery-ui": "1.12.1","cashify": "^2.5.0","jquery.cookie": "^1.4.1","jquery-form": "^4.3.0","bs-custom-file-input": "^1.3.4","uniform.js": "^2.2.2"
    },"dependencies": {
        "bootstrap": "^4.1.1","bootstrap-colorpicker": "^3.2.0","bootstrap-datepicker": "^1.9.0","bootstrap-daterangepicker": "^3.0.3","bootstrap-fileinput": "^4.4.8","chartjs": "^0.3.24","emojionearea": "^3.4.2","jarallax": "^1.12.5","jquery-migrate": "^3.3.2","js-cookie": "^2.2.0","mdbootstrap": "^4.19.2","mdbootstrap-pro": "git+https://oauth2:xxx@git.mdbootstrap.com/mdb/jquery/jq-pro.git#4.19.2","select2": "^4.0.6-rc.1","timeago": "^1.6.7"
    },"license": "UNLICENSED","private": true,"scripts": {
        "dev-server": "encore dev-server","dev": "encore dev","watch": "encore dev --watch","build": "encore production"
    }
}

webpack.config.js

const Encore = require('@symfony/webpack-encore');
const Path = require('path');

Encore
    .setOutputPath('./../../public/webpack/front')
    .setPublicPath('/webpack/front')

    .addEntry('js/app','./js/app.js')
    .addStyleEntry('css/app','./scss/app.scss')

    .splitEntryChunks()
    .enableSingleRuntimeChunk()
    .cleanupOutputBeforeBuild()
    .enableBuildNotifications()
    .enableSourceMaps(!Encore.isProduction())
    .enableVersioning(Encore.isProduction())
    .autoProvidejQuery()
    .enableSassLoader()
    .enableLessLoader()
    // .addExternals({
    //     jquery: 'jQuery'
    // })
    // .addPlugin(new webpack.ProvidePlugin({
    //     $: 'jquery',//     jQuery: 'jquery',//     'window.jQuery': 'jquery',// }))

    // .addLoader({
    //     test: require.resolve('jquery'),//     use:[
    //         {
    //             loader: 'expose-loader',//             options: 'jQuery'
    //         },//         {
    //             loader: 'expose-loader',//             options: 'jquery'
    //         },//             options: '$'
    //         }
    //     ]
    // })
;

let config = Encore.getWebpackConfig();

config.resolve.modules = [Path.resolve(__dirname,'node_modules')]; //default path to node_modules dir

module.exports = config;

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...