Comments (6)
router4已经不支持require.ensure了。可以参考https://juejin.im/post/58f9717e44d9040069d06cd6
from react-molin.
如果发现某个模块打包后过大的话,可以把它单独拆分出来。
from react-molin.
@Molin123 router4 参考你写的文档,能实现,但打包后文件很大,没有实用价值,用法跟文档写的一样,不知道你这边有没有实战过
from react-molin.
文件很大?请把数据贴出来看一下,查一下原因。或者把代码发给我我给你看一下。
from react-molin.
不好意思,好像是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.
Thanks a lot all of you.
from react-molin.
Related Issues (14)
- 貌似有报错 HOT 8
- 没有看懂试例? HOT 4
- 引入antd-mobile 中的Popup组件报错 HOT 11
- npm run start 报错 HOT 1
- less编译时报错
- this.props.match.path 找不到
- 设置host,提个小建议 HOT 4
- 部署到tomcat,提示找不到访问路经 HOT 1
- 感觉JSX的语法配置还是要写在webpack配置文件里面 HOT 1
- 可以加eslint校验代码 HOT 1
- 本地项目引入antd-mobile源码
- fetch HOT 4
- webpack HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-molin.