Initial commit

This commit is contained in:
2020-05-17 14:36:52 +08:00
commit 8a10db1037
9 changed files with 146 additions and 0 deletions

38
webpack.config.js Normal file
View File

@@ -0,0 +1,38 @@
const path = require('path');
const webpack = require('webpack');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const workSpaceDir = path.resolve(__dirname);
module.exports = (env) => {
if (!env) { env = {production: false};}
console.log("Compile environment:", env);
return ({
target: 'node',
entry: path.join(workSpaceDir, 'src/main.ts'),
output: {
path: path.join(workSpaceDir, 'dist'),
filename: 'binary.js'
},
module: {
rules: [
{ test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ },
{ test:/\.ya?ml$/, use: [ "json-loader", "yaml-loader" ] },
{ test:/\.(html|txt|md)$/, use: "raw-loader" },
]
},
resolve: {
extensions: [
'.tsx', '.ts', '.js',
".yaml", ".html", ".md", ".txt"
],
plugins: [
new TsconfigPathsPlugin({configFile: path.join(workSpaceDir, 'tsconfig.json')})
]
},
externals: {},
plugins: [
],
devtool: env.production ? "" : "source-map",
mode: "development",
});
};