const path = require("path");
export default {
// entry: "src/index.js", //
entry: {
app: [path.resolve(__dirname, "src/polyfill.js"), path.resolve(__dirname, "src/index.js")] //
},
extraBabelPlugins: [
["import", { libraryName: "antd", libraryDirectory: "es", style: true }],
],
env: {
development: {
extraBabelPlugins: ["dva-hmr"],
},
},
alias: {
"components": path.resolve(__dirname, "src/components/"),
"utils": path.resolve(__dirname, "src/utils/"),
"assets": path.resolve(__dirname, "src/assets"),
"services": path.resolve(__dirname, "src/services"),
"pages": path.resolve(__dirname, "src/pages"),
"layouts": path.resolve(__dirname, "src/layouts"),
"models": path.resolve(__dirname, "src/models"),
"@": path.resolve(__dirname, "src"),
},
ignoreMomentLocale: true,
html: {
template: "./src/index.ejs",
},
lessLoaderOptions: {
javascriptEnabled: true,
},
disableDynamicImport: true,
publicPath: "/",
hash: true,
extraBabelIncludes: ["react-native-progress"],
};
integrates a polyfill.js, for compatibility with ie, but since the .webpackrc.js configuration changes have been made above, the file changes cannot be refreshed automatically. (it doesn"t work on index.js, import polyfill.js)
// polyfill.js
import "@babel/polyfill";
import "url-polyfill";
import setprototypeof from "setprototypeof";
// React depends on set/map/requestAnimationFrame
// https://reactjs.org/docs/javascript-environment-requirements.html
import "core-js/es6/promise";
import "core-js/es6/set";
import "core-js/es6/map";
// import "raf/polyfill";
//IE10fetchpolyfill whatwg-fetchIE10
// https://github.com/umijs/umi/issues/413
Object.setPrototypeOf = setprototypeof;
has anyone ever encountered this problem? solve it!