webpack gateway, ingame 분리
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
|||||||
|
type ErrType<T> = { new(msg?: string): T }
|
||||||
|
type Nullable<T> = T | null | undefined
|
||||||
|
|
||||||
|
export class RuntimeError extends Error {
|
||||||
|
public name = 'RuntimeError';
|
||||||
|
constructor(public message: string = '') {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
toString(): string {
|
||||||
|
if (this.message) {
|
||||||
|
return this.name + ': ' + this.message;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class NotNullExpected extends RuntimeError {
|
||||||
|
public name = 'NotNullExpected';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unwrap<T>(result: Nullable<T>): T {
|
||||||
|
if (result === null || result === undefined) {
|
||||||
|
throw new NotNullExpected();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unwrap_err<T, ErrT extends Error>(result: Nullable<T>, errType: ErrType<ErrT>, errMsg?: string): T {
|
||||||
|
if (result === null || result === undefined) {
|
||||||
|
throw new errType(errMsg);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
+60
-27
@@ -1,31 +1,64 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = [
|
||||||
resolve: {
|
{
|
||||||
extensions: [".ts", ".tsx"]
|
name: 'ingame',
|
||||||
},
|
resolve: {
|
||||||
entry: {
|
extensions: [".ts", ".tsx"]
|
||||||
inheritPoint: './hwe/ts/inheritPoint.ts',
|
},
|
||||||
},
|
entry: {
|
||||||
output: {
|
inheritPoint: './hwe/ts/inheritPoint.ts',
|
||||||
filename: '[name].js',
|
},
|
||||||
path: path.resolve(__dirname, 'hwe/js'),
|
output: {
|
||||||
},
|
filename: '[name].js',
|
||||||
mode: 'production',
|
path: path.resolve(__dirname, 'hwe/js'),
|
||||||
devtool: 'source-map',
|
},
|
||||||
module: {
|
mode: 'production',
|
||||||
rules: [{
|
devtool: 'source-map',
|
||||||
test: /\.(ts|tsx)$/,
|
module: {
|
||||||
exclude: /(node_modules)/,
|
rules: [{
|
||||||
use: {
|
test: /\.(ts|tsx)$/,
|
||||||
loader: 'babel-loader',
|
exclude: /(node_modules)/,
|
||||||
options: {
|
use: {
|
||||||
presets: [
|
loader: 'babel-loader',
|
||||||
'@babel/preset-env',
|
options: {
|
||||||
'@babel/preset-typescript'
|
presets: [
|
||||||
]
|
'@babel/preset-env',
|
||||||
|
'@babel/preset-typescript'
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}]
|
||||||
}]
|
},
|
||||||
},
|
},
|
||||||
}
|
{
|
||||||
|
name: 'gateway',
|
||||||
|
resolve: {
|
||||||
|
extensions: [".ts", ".tsx"]
|
||||||
|
},
|
||||||
|
entry: {
|
||||||
|
//test: './ts/test.ts',
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: '[name].js',
|
||||||
|
path: path.resolve(__dirname, 'js'),
|
||||||
|
},
|
||||||
|
mode: 'none',
|
||||||
|
devtool: 'source-map',
|
||||||
|
module: {
|
||||||
|
rules: [{
|
||||||
|
test: /\.(ts|tsx)$/,
|
||||||
|
exclude: /(node_modules)/,
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
presets: [
|
||||||
|
'@babel/preset-env',
|
||||||
|
'@babel/preset-typescript'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user