我目前正在测试一个依赖于带有webpack外部的外部脚本的组件。
DBPanel.js:
import React, { PureComponent } from 'react';
import $ from 'jquery';
webpack externals文件如下所示:
webpack.config.js:
externals: {
jquery: "jQuery",
Materialize: "Materialize"
}
当我在测试import DBPanel from '../components/DBPanel';
中导入文件时出现此错误:
Error: Cannot find module 'jquery'