我对Visual Studio Code和gulp有疑问。
我正在将打字稿版本3.7.2与最新版本的Visual Studio代码一起使用。当我运行gulp build时,得到以下输出:
[12:03:36] Starting gulp
[12:03:36] Starting 'build'...
[12:03:36] Starting subtask 'configure-sp-build-rig'...
[12:03:36] Finished subtask 'configure-sp-build-rig' after 6.42 ms
[12:03:36] Starting subtask 'pre-copy'...
[12:03:36] Finished subtask 'pre-copy' after 55 ms
[12:03:36] Starting subtask 'copy-static-assets'...
[12:03:36] Starting subtask 'sass'...
[12:03:37] Finished subtask 'sass' after 1.38 s
[12:03:37] Starting subtask 'tslint'...
[12:03:39] [tslint] tslint version: 5.12.1
[12:03:39] Starting subtask 'tsc'...
[12:03:39] [tsc] typescript version: 2.9.2
[12:03:40] Finished subtask 'copy-static-assets' after 4.46 s
[12:03:48] Finished subtask 'tslint' after 10 s
[12:03:49] Finished subtask 'tsc' after 10 s
[12:03:49] Starting subtask 'post-copy'...
[12:03:49] Finished subtask 'post-copy' after 428 μs
[12:03:49] Finished 'build' after 14 s
[12:03:50] ==================[ Finished ]==================
我的问题特别是关于1行:
[12:03:39] [tsc] typescript version: 2.9.2
为什么我安装了3.7.2后使用打字稿2.9.2版?有办法改变吗?
编辑:
完整gulpfile.js
'use strict';
const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
// Taken from: https://blog.mastykarz.nl/correctly-reference-images-sharepoint-framework-solutions/
build.configureWebpack.mergeConfig({
additionalConfiguration: generatedConfiguration => {
if (build.getConfig().production) {
var basePath = build.writeManifests.taskConfig.cdnBasePath;
if (!basePath.endsWith('/')) {
basePath += '/';
}
generatedConfiguration.output.publicPath = basePath;
}
else
{
generatedConfiguration.output.publicPath = '/dist/';
}
return generatedConfiguration;
},
});
build.initialize(gulp);
我正在用口水3.9.1。我尝试升级,但遇到问题,因此不得不降级。
[我发现了一篇引导我朝正确方向HERE的文章。现在我看到以下内容:
[tsc] typescript version: 3.3.4000
仍未使用3.7.2,但我想它已经足够了。希望这对其他人有帮助...