我在 webpack.config 中为 material-ui 定义了外部
module.exports = [{
entry: ...
output:...
externals: {
react: {
commonjs: "react",
commonjs2: "react"
},
"material-ui": {
commonjs: "material-ui",
commonjs2: "material-ui"
}
},
module: ...
}];
仍然是它给出的错误,例如-
无法解析模块“material-ui/IconButton”......
在我的条目 js 文件中,我有
import React, {Component} from "react";
import IconButton from "material-ui/IconButton";
.....
.....