html: migrate to typescript

This commit is contained in:
Shuanglei Tao
2019-05-15 23:52:22 +08:00
parent ba7779547d
commit cd1241c0f3
10 changed files with 614 additions and 453 deletions

View File

@@ -3,7 +3,7 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const devMode = process.env.NODE_ENV !== 'production';
module.exports = {
entry: './js/app.js',
entry: './js/app.ts',
output: {
path: __dirname + '/dist',
filename: devMode ? '[name].js' : '[name].[hash].js',
@@ -12,7 +12,7 @@ module.exports = {
rules: [
{
test: /\.js$/,
exclude: /node_modules\/(?!zmodem.js\/)/,
include: __dirname + '/node_modules/zmodem.js',
use: {
loader: 'babel-loader',
options: {
@@ -20,6 +20,11 @@ module.exports = {
}
},
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.s?[ac]ss$/,
use: [
@@ -30,6 +35,9 @@ module.exports = {
},
]
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ]
},
plugins: [
new CopyWebpackPlugin([
{ from: 'favicon.png', to: '.' }
@@ -42,5 +50,5 @@ module.exports = {
performance : {
hints : false
},
devtool: devMode ? 'cheap-module-eval-source-map' : 'source-map',
}
devtool: 'inline-source-map',
};