Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
365 views
in Technique[技术] by (71.8m points)

文件import导入的js,webpack打包时怎么单独打包?

jsx文件引入
import 'echarts/map/js/usa.js';

部署时webpack怎么单独打包出来?

换一种说法,如果我想把项目文件打包成多个js文件,webpack该如何配置?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

如果你的echarts已经修改成了通过cdn引入的话,可以试试在index.html这么写:

<script src="http://cdn.bootcss.com/echarts/3.4.0/echarts.min.js"></script>
<script src="http://xxxxxxxxxxxxxxxxxx/usa.js"></script>

把usa.js文件放到cdn(七牛等)上然后在echarts后面引用。
然后去掉代码中的"import 'echarts/map/js/usa'"。

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...