![](/img/trans.png)
[英]Dialog asking “Update Dependencies from package.json” offers “Run 'npm install'” button, *after* I have already run my Vaadin 14.0.8 app successfully
[英]Vaadin: Reduce package.json to the only used dependencies in production mode
我們在我們的項目中使用來自 Synopsis 的 BlackDuck 來識別我們使用的依賴項的許可證。 Vaadin 實際上有一個小問題:當我們構建前端時——基於 Vaadin Core——在生產模式下,package.json 中塞滿了比我們使用的更多的依賴項。 它還包括專業版的功能。 由於 BlackDuck 的檢測腳本掃描了這個 package.json,我們得到了很多“誤報”。 那么有沒有辦法通過 Vaadin 創建構建來將 package.json 減少到唯一需要的依賴項? 據我所知,在開始構建時,package.json 將始終被覆蓋。 當然,之后我可以用腳本“破解” package.json,但這不是我想要的方式。 這是我們創建“生產就緒”前端源的配置文件:
<profile>
<id>production-mode</id>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<productionMode>true</productionMode>
</configuration>
</plugin>
</plugins>
</build>
</profile>
提前感謝您的幫助!
更新:這個回應是基於猜測,而不是事情的實際運作方式。
Vaadin 生成到package.json
中的依賴項基於通過 Maven 或 Gradle 定義的 Java 依賴項。
如果您想擁有所有免費組件但又想避免使用商業組件,那么您只需將com.vaadin:vaadin
依賴項更改為com.vaadin:vaadin-core
。 如果您想要更細化,那么您可以排除您不想要的那些,或者通過僅包含您認為需要的東西從https://mvnrepository.com/artifact中列出的依賴項中構建自己的平台/com.vaadin/vaadin-core/23.0.8 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.