Giter Club home page Giter Club logo

Comments (6)

Molin123 avatar Molin123 commented on May 24, 2024 1

router4已经不支持require.ensure了。可以参考https://juejin.im/post/58f9717e44d9040069d06cd6

from react-molin.

Molin123 avatar Molin123 commented on May 24, 2024 1

如果发现某个模块打包后过大的话,可以把它单独拆分出来。

from react-molin.

BruceCham avatar BruceCham commented on May 24, 2024

@Molin123 router4 参考你写的文档,能实现,但打包后文件很大,没有实用价值,用法跟文档写的一样,不知道你这边有没有实战过

from react-molin.

Molin123 avatar Molin123 commented on May 24, 2024

文件很大?请把数据贴出来看一下,查一下原因。或者把代码发给我我给你看一下。

from react-molin.

BruceCham avatar BruceCham commented on May 24, 2024

不好意思,好像是g2这块的问题,我还在看,把代码换成普通的就正常了,如果是如下代码,打包出来很大

大体的代码如下:
components 代码

import createG2 from 'g2-react'
import { Stat } from 'g2'
import React, { Component } from 'react'

const Chart = createG2(chart => {
  chart.col('month', {
    alias: '月份',
    range: [0, 1]
  })
  chart.col('temperature', {
    alias: '平均温度(°C)'
  })
  chart.line().position('month*temperature').size(2)
  chart.render()
})
class MyComponent extends React.Component {
  state = {
    data: [
      { month: 'Jan', temperature: 7.0 },
      { month: 'Feb', temperature: 6.9 },
      { month: 'Mar', temperature: 9.5 },
      { month: 'Apr', temperature: 14.5 },
      { month: 'May', temperature: 18.2 },
      { month: 'Jun', temperature: 21.5 },
      { month: 'Jul', temperature: 25.2 },
      { month: 'Aug', temperature: 26.5 },
      { month: 'Sep', temperature: 23.3 },
      { month: 'Oct', temperature: 18.3 },
      { month: 'Nov', temperature: 13.9 },
      { month: 'Dec', temperature: 9.6 }
    ],
    forceFit: true,
    width: 500,
    height: 450
  }
  render() {
    return (
      <div>
        <Chart
          data={this.state.data}
          width={this.state.width}
          height={this.state.height}
          forceFit={this.state.forceFit} />
      </div>
    )
  }
}

export default MyComponent

router调用

import { Bundle } from '@/utils'
import DataBoard from 'bundle-loader?lazy!@/containers/DataBoardContainer'

const List = () => (
  <Bundle load={DataBoard}>
    {(List) => <List />}
  </Bundle>
)

from react-molin.

Shinepans avatar Shinepans commented on May 24, 2024

Thanks a lot all of you.

from react-molin.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.