Coder Social home page Coder Social logo

Comments (4)

2betop avatar 2betop commented on September 28, 2024
  1. 你说的注释是代码里面本来就有的 /*!xxx 格式的注释,还是说 loader allInOne 打包的时候给添加上的? 如果是第一种,我觉得 uglify 插件中,肯定有配置项去掉这部分注释,如果是第二种, 目前 loader 确实没有配置项 https://github.com/fex-team/fis3-postpackager-loader/blob/master/lib/pack.js#L127 应该像这个插件一样添加一个 fex-team/fis3-packager-map#6
  2. 你说的问题其实是因为你没有开启按需编译造成的编译浪费,开启按需编译即可。如下,指定编译入口文件是 *.html 然后fis编译时分析其引用的资源,深入分析。
fis.set('project.files', ['*.html']);

from fis3-postpackager-loader.

renxia avatar renxia commented on September 28, 2024

第一个问题是对于 min 希望不经过 uglify 处理,只去除注释。

关于第二个问题
你所说的“按需编译”怎么理解其逻辑,对于 js、css 的压缩处理是在单文件处理流程中进行的,那么首先要 match 对应的文件。
你的意思是不是可以这样理解,如果不显示的配置 match 这些文件,只设置入口,那么 fis 会自动分析加入 release 队列中?

但参考 fis release 流程原理,好像这种引用也是在打包流程中通过 loader 插件才会做的静态分析吧

from fis3-postpackager-loader.

2betop avatar 2betop commented on September 28, 2024

文件参不参与单文件编译跟 match 无关,而是跟 project.files 这个配置项有关。默认 project.fies*,这样的话,你的项目目录下面的所有代码几乎都会参与编译,压缩,然后再packager阶段合并。实际上有很多代码是没用到的,也会参与编译,最耗时的是压缩。

所以我的建议是开启按需编译,把默认的 * 改成 *.html 这样,还是继续单文件编译期去做压缩,但是只会是用到了的文件才参与。然后到了 packager 阶段,只需要做简单拼接就够了。

我知道你希望的是,单文件编译期不压缩,在 loader 合并之后再对合并后的资源做一次压缩。其实我对这个需求的解读就是不希望做过多的没用文件的压缩。换成按需编译后,还是原来的编译流程,但是解决编译无用文件的问题。效果是差不多的。

from fis3-postpackager-loader.

renxia avatar renxia commented on September 28, 2024

是的,我是觉得在最后做统一压缩会最省时。
你说的“按需编译”我之前没有注意到,应该算是比较细节的了,如果确实如你所说那么在配置上应该要简单多了。
我先测试一下,非常的感谢!

from fis3-postpackager-loader.

Related Issues (20)

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.