1 Introduction
Tried uniapp, vue2, vue3, typescript, vite, nvue and other technologies, wrote two pages, and the two pages added up to less than 400 lines of code.
Four combinations were tried:
Combination 1: uniapp + vue2 + JavaScript + nvue file + non-fast mode
Combination 2: uniapp + vue2 + JavaScript + nvue file + fast mode
Combination 3: uniapp + vue3 + TypeScript + vue file + Vite + fast mode
Combination 4: uniapp + vue3 + TypeScript + nvue file + Vite + fast mode
Note 1: The fast mode refers to the configuration under the app-plus node of the manifest.json file:"nvueLaunchMode" : "fast",
Note 2: The fast mode in combination 3 should not work, because the vue file is used instead of the nvue file.
2. Comparison of test results
combination | APP start time | Supplementary Note |
---|---|---|
combination 1 | 1.17s | Early uniapp common combinations |
combination 2 | 1.20s | Tested fast mode, did not improve the startup speed |
combination 3 | 1.45s | Test whether typescript+vue3 can write projects |
combination 4 | 0.87s | Test the Optimal Technology Combination |
The APP startup time refers to the time from clicking the APP icon to the first page appearing after the production environment installation package is packaged through the dcloud channel.
2023-7-7 Update: The startup time of combination 4 has been updated. The previous version could not be started, but now it can be started (HBuilderX3.8.7).
3. Conclusion
There are still many test combinations that I haven’t tried, and I don’t have time to try them one by one. It’s been a day for these four combinations~
[Conclusion after July 7, 2023]:
For new projects, the currently recommended combination is combination 4: uniapp + vue3 + TypeScript + nvue file + Vite + fast mode.
[Conclusion before 2023-7-7]:
Originally, what I wanted to test the most was the combination 4 (uniapp + vue3 + TypeScript + nvue file + fast mode), but unfortunately on this node (May 26, 2023), HBuilderX3.7.11 cannot run, so I have to give up. [On the evening of May 26, 2023, the HBuilderX3.8.3 version was released, and I tested it again, but it still didn't work]
For new projects, the currently recommended combination is combination 3: uniapp + vue3 + TypeScript + vue file + fast mode.
4. Supplementary Notes
In this document it is clearly written:
Using typescript/ts in nvue pages is currently not supported.
But in this document it is clearly written:
The vue3 mode of uni-app: both vue files and nvue files support the latest version of ts.
There is a contradiction between the two documents. After the personal test, it is found that the nvue file does not support typescript (or although the official claims to support it, there is a bug that prevents the project from running).