Giter VIP home page Giter VIP logo

Comments (14)

JuneAndGreen avatar JuneAndGreen commented on July 22, 2024 1

[email protected]

image

支持了编译的一些配置,应该可以满足你的需求了,可参考 demo10。

from miniprogram-simulate.

JuneAndGreen avatar JuneAndGreen commented on July 22, 2024

https://github.com/wechat-miniprogram/miniprogram-simulate/blob/master/docs/api.md#options

image

动态调整缓存大小我看看,不过这里可以调整目录的,本工具作为组件单测使用,建议按目录传入以免全量编译。

from miniprogram-simulate.

aa875982361 avatar aa875982361 commented on July 22, 2024

@JuneAndGreen 有看到的,但是因为组件引用路径是全局的,所以必须要设置rootPath为小程序的。
比如说组件.json:
{ "usingComponents": { "compa":"/pages/components/compa" } }
修改源代码也可以,但是改动会比较大

from miniprogram-simulate.

JuneAndGreen avatar JuneAndGreen commented on July 22, 2024

这个其实也可以在调 load 的时候改掉的,这样就不会因为 usingComponents 而导致必须使用大范围的 rootPath:

image

from miniprogram-simulate.

aa875982361 avatar aa875982361 commented on July 22, 2024

@JuneAndGreen 我试了,是可以的,感谢。但是如果有引用到wxs,就会报错找不到wxs,因为wxs并不是在组件下面。
能否让用户传入需要的wxml 和 wxs 文件路径列表?我看底层实现是找根目录下的全部wxml和wxs
比如说我通过分析wxml 和 json 文件,找到依赖的wxml和wxs文件路径,然后通过配置传进去?

from miniprogram-simulate.

JuneAndGreen avatar JuneAndGreen commented on July 22, 2024

emmm,这情况比较麻烦。

wxs 目前做不到,主要 wxs、wxss 和 wxml import 的路径处理都是由 wcsc 和 wcc 来处理的,这两个用的和工具用的编译器是同一个,我这边只是直接借用编译器无法侵入去改造。

from miniprogram-simulate.

aa875982361 avatar aa875982361 commented on July 22, 2024

@JuneAndGreen 我这边有个想法不知道行不行。
我看了miniprogram-compiler的wxmlToJs逻辑,里面遍历了全量wxml 和wxs,拿到wxmlList 和 wxsList
如果可以修改这个库的逻辑的话,那是不是就可以通过外部传入wxmlList 和 wxsList。
image
然后在外部去分析组件依赖的wxml,和wxs,得到wxmlList和wxsList。
不知道这样行不行。

from miniprogram-simulate.

aa875982361 avatar aa875982361 commented on July 22, 2024

https://github.com/wechat-miniprogram/miniprogram-simulate/pull/84/files
这是我做的处理,可以看一下

from miniprogram-simulate.

aa875982361 avatar aa875982361 commented on July 22, 2024

image

@JuneAndGreen 可以问下这里是忘记更新么?

from miniprogram-simulate.

JuneAndGreen avatar JuneAndGreen commented on July 22, 2024
image

@JuneAndGreen 可以问下这里是忘记更新么?

噢,是的,这份之前是其他同学帮忙弄的,我这边遗漏了。

from miniprogram-simulate.

JuneAndGreen avatar JuneAndGreen commented on July 22, 2024

改了 [email protected],再试试看?

还有文档这里之前也笔误了,也一并改了:

image

from miniprogram-simulate.

aa875982361 avatar aa875982361 commented on July 22, 2024

可以了 感谢~
对了,之前在排查问题的时候,花了比较久的时间才排查到时因为缓存区的问题,感觉有时间可以优化一下。
我之前是通过打断点的方式找到错误的,比较麻烦。
image

from miniprogram-simulate.

JuneAndGreen avatar JuneAndGreen commented on July 22, 2024

可以的,我记一下。

from miniprogram-simulate.

JuneAndGreen avatar JuneAndGreen commented on July 22, 2024

可以了 感谢~ 对了,之前在排查问题的时候,花了比较久的时间才排查到时因为缓存区的问题,感觉有时间可以优化一下。 我之前是通过打断点的方式找到错误的,比较麻烦。 image

[email protected] 补充了,会将 spawnSync 的异常直接抛出来

from miniprogram-simulate.

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.