lwd-technology / react-app-rewire-provide-plugin

Add webpack.ProvidePlugin to a react-app-rewired config.
MIT License
4 stars 0 forks source link

why I new object but is error #1

Closed zhangwei900808 closed 5 years ago

zhangwei900808 commented 5 years ago
const { override, fixBabelImports, addDecoratorsLegacy } = require("customize-cra");
const rewireProvidePlugin = require("react-app-rewire-provide-plugin");

module.exports = function(config, env) {
  config.plugins.push(
    rewireProvidePlugin(config, env, {
      BMap: "BMap",
      BMapLib: "BMapLib"
    })
  );
  return Object.assign(
    config,
    override(
      /**启动装饰器 */
      addDecoratorsLegacy(),
      /**配置antd */
      fixBabelImports("import", {
        libraryName: "antd",
        libraryDirectory: "es",
        style: "css"
      })
    )(config, env)
  );
};

image

zhangwei900808 commented 5 years ago
const { BMap, BMAP_STATUS_SUCCESS, lastInfoBox, BMapLib, INFOBOX_AT_TOP } = window;

OK^_^