简体   繁体   English

带导入的Foundation 6.4 app.js Handpick组件

[英]Foundation 6.4 app.js Handpick components with import

Using the new Panini Zurb template with webpack. 在Webpack中使用新的Panini Zurb模板。 It is not clear yet how to handpick modules/components following the one line of instructions they provide in app.js: 尚不清楚如何按照app.js中提供的一行指令手动选择模块/组件:

import $ from 'jquery';
// import whatInput from 'what-input';
window.$ = $;

// import Foundation from 'foundation-sites';
// If you want to pick and choose which modules to include, comment out 
 the above and uncomment
// the line below
// import './lib/foundation-explicit-pieces';
import {Tabs} from './lib/foundation-explicit-pieces';


$(document).foundation();
// if($('#about-tabs').length) {var _tabs = new Foundation.Tabs($('#about-tabs'));}

link to the section: github repo 链接到本节: github repo

And at this point it's working, but it seems like everything in foundation is packaged resulting in a ~270KB file. 至此,它可以正常工作了,但似乎基础中的所有内容都打包了,导致文件大小约为270KB。

I'm definitely not aware of all the aspects of import/export, any suggestion on a comprehensive source will be very appreciated. 我绝对不了解进出口的所有方面,对任何综合来源的建议将不胜感激。

Apparently it was intuitive enough, in the support file it's enough to comment out the single imports. 显然,它足够直观,在支持文件中,足以注释掉单个导入。

With all out but 1 component the filesize becomes still ~160KB after build. 除了1个组件外,构建后的文件大小仍然约为160KB。

Any way to tree shake more? 还有什么方法可以摇树吗? It's basically the same as the previous version without webpack 与没有webpack的先前版本基本相同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM