-
Notifications
You must be signed in to change notification settings - Fork 130
feat: translate Integrating with Build Tools.md in zh-CN #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: translate Integrating with Build Tools.md in zh-CN #175
Conversation
Thanks for the PR! This section of the codebase is owned by @Kingwl - if they write a comment saying "LGTM" then it will be merged. |
Translation of Integrating with Build Tools.mdtitle: Integrates with build tools translatable: trueBabelInstallationnpm install @babel/cli @babel/core @babel/preset-typescript --save-dev .babelrc{
"presets": ["@babel/preset-typescript"]
} Command line execution./node_modules/.bin/babel --out-file bundle.js src/index.ts package.json{
"scripts": {
"build": "babel --out-file bundle.js main.ts"
},
} Execute Babel from the command linenpm run build BrowserifyInstallationnpm install tsify Command line executionbrowserify main.ts -p [ tsify --noImplicitAny ] > bundle.js Use the APIvar browserify = require("browserify");
var tsify = require("tsify");
browserify()
.add("main.ts")
.plugin("tsify", { noImplicitAny: true })
.bundle()
.pipe(process.stdout); More details: smrq/tsify GruntInstallationnpm install grunt-ts Base Gruntfile .jsmodule.exports = function (grunt) {
grunt.initConfig({
ts: {
default: {
src: ["**/*.ts", "!node_modules/**/*.ts"],
},
},
});
grunt.loadNpmTasks("grunt-ts");
grunt.registerTask("default", ["ts"]);
}; More details: TypeStrong/grunt-ts GulpInstallationnpm install gulp-typescript Base gulpfile .jsvar gulp = require("gulp");
var ts = require("gulp-typescript");
gulp.task("default", function () {
var tsResult = gulp.src("src/*.ts").pipe(
ts({
noImplicitAny: true,
out: "output.js",
})
);
return tsResult.js.pipe(gulp.dest("built/local"));
}); More details: ivogabe/gulp-typescript JspmInstallationnpm install -g jspm@beta Note: TypeScript is currently supported in version 0.16beta of jspm More details: TypeScriptSamples/jspm MSBuildUpdate the project files, including those installed locally <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Include default props at the top -->
<Import
Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props"
Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
<!-- TypeScript configurations go here -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptRemoveComments>false</TypeScriptRemoveComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptRemoveComments>true</TypeScriptRemoveComments>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
</PropertyGroup>
<!-- Include default targets at the bottom -->
<Import
Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets"
Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
</Project> More details about defining MSBuild compiler options: Set compiler options in the MSBuild project NuGet
More details can be viewed Package Manager Dialog and using nightly builds with NuGet RollupInstallation
Please note that useCreate one // rollup.config.js
import typescript from '@rollup/plugin-typescript';
export default {
input: 'src/index.ts',
output: {
dir: 'output',
format: 'cjs'
},
plugins: [typescript()]
}; Svelte CompilerInstallation
Please note that You can also consider using useCreate one // svelte.config.js
import preprocess from 'svelte-preprocess';
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess()
};
export default config; Now you can specify that the script block be written in TypeScript:
ViteVite supports out-of-the-box imports WebpackInstallationnpm install ts-loader --save-dev Basic webpack.config .js when using Webpack version 5 or 4const path = require('path');
module.exports = {
entry: './src/index.ts',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
}; See more ts-loader details here. Alternatives: |
translate Integrating with Build Tools.md in zh-CN