标签:source enc license key 3.2 new 目录 client 2.0
typescript 基本环境 搭建vs code
扩展-- 主题
One Dark Pro
npm init
package.json
{
"name": "client-side",
"version": "1.0.0",
"description": "source code of ts-learning",
"main": "./src/index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"typescript",
"source_code",
"hequan"
],
"author": "hequan <hequan2011@sina.com>",
"license": "MIT"
}
目录
build
webpack.config.js
package.json
src
api
assets
font
img
config
tools
utils
typings
安装
npm install -g typescript tslint ts-loader cross-env
tsc --init
npm install webpack webpack-cli webpack-dev-server clean-webpack-plugin html-webpack-plugin -D
npm install typescript -S
package.json
{
"name": "client-side",
"version": "1.0.0",
"description": "source code of ts-learning",
"main": "./src/index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js",
"build": "cross-env NODE_ENV=production webpack --config ./build/webpack.config.js"
},
"keywords": [
"typescript"
],
"author": "hequan<hequan2011@sina.com>",
"license": "MIT",
"devDependencies": {
"clean-webpack-plugin": "^2.0.0",
"cross-env": "^5.2.0",
"html-webpack-plugin": "^3.2.0",
"ts-loader": "^5.3.3",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3",
"webpack-dev-server": "^3.2.1"
},
"dependencies": {
"typescript": "^3.3.3333"
}
}
webpack.config.js
const HtmlWebpackPlugin = require(‘html-webpack-plugin‘)
const CleanWebpackPlugin = require(‘clean-webpack-plugin‘)
module.exports = {
entry: "./src/index.ts",
output: {
filename: "main.js"
},
resolve: {
extensions: [‘.ts‘, ‘.tsx‘, ‘.js‘]
},
module: {
rules: [{
test: /\.tsx?$/,
use: ‘ts-loader‘,
exclude: /node_modules/
}]
},
devtool: process.env.NODE_ENV === ‘production‘ ? false : ‘inline-source-map‘,
devServer: {
contentBase: ‘./dist‘,
stats: ‘errors-only‘,
compress: false,
host: ‘localhost‘,
port: 8089
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [‘./dist‘]
}),
new HtmlWebpackPlugin({
template: ‘./src/template/index.html‘
})
]
}
标签:source enc license key 3.2 new 目录 client 2.0
原文地址:https://blog.51cto.com/hequan/2363220