Add minification
This commit is contained in:
parent
b3da27e73b
commit
d34f25295c
14 changed files with 142 additions and 94 deletions
|
|
@ -2,9 +2,19 @@
|
|||
"name": "shared",
|
||||
"private": true,
|
||||
"description": "Shared library between backend and frontend",
|
||||
"main": "src/main.ts",
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "webpack --mode development --watch",
|
||||
"lint": "eslint --fix \"src/**/*.ts\" && prettier --write \"src/**/*.ts\"",
|
||||
"build": "webpack --mode production",
|
||||
"try-build-before": "npm run build",
|
||||
"initialize": "npm install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"terser-webpack-plugin": "^2.3.8",
|
||||
"ts-loader": "^8.0.3",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { Command } from '../command';
|
||||
|
||||
export class StepCommand extends Command {
|
||||
public constructor(public readonly deltaTimeInMiliseconds: DOMHighResTimeStamp) {
|
||||
public constructor(public readonly deltaTimeInMiliseconds: number) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export const serialize = (object): string => {
|
||||
export const serialize = (object: any): string => {
|
||||
return JSON.stringify(object, (_, value) => {
|
||||
if (value?.__serializable_type) {
|
||||
return [value.__serializable_type, ...value.toArray()];
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/",
|
||||
"outDir": "lib",
|
||||
"sourceMap": true,
|
||||
"noImplicitAny": false,
|
||||
"target": "es6",
|
||||
"downlevelIteration": true,
|
||||
"allowJs": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"target": "es2015",
|
||||
"esModuleInterop": true,
|
||||
"strict": true,
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"downlevelIteration": true,
|
||||
"moduleResolution": "Node",
|
||||
"module": "es6",
|
||||
"composite": true,
|
||||
"lib": [
|
||||
"es2015",
|
||||
"dom"
|
||||
"dom",
|
||||
"es2017"
|
||||
]
|
||||
}
|
||||
}
|
||||
48
shared/webpack.config.js
Normal file
48
shared/webpack.config.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
const path = require('path');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
|
||||
const PATHS = {
|
||||
entryPoint: path.resolve(__dirname, 'src/main.ts'),
|
||||
bundles: path.resolve(__dirname, 'lib'),
|
||||
};
|
||||
|
||||
module.exports = (env, argv) => ({
|
||||
entry: {
|
||||
main: PATHS.entryPoint,
|
||||
},
|
||||
target: 'node',
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
path: PATHS.bundles,
|
||||
libraryTarget: 'umd',
|
||||
umdNamedDefine: true,
|
||||
},
|
||||
devtool: argv.mode === 'development' ? 'source-map' : false,
|
||||
watchOptions: {
|
||||
poll: true,
|
||||
ignored: /node_modules/
|
||||
},
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin({
|
||||
protectWebpackAssets: false,
|
||||
cleanAfterEveryBuildPatterns: [],
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
use: {
|
||||
loader: 'ts-loader',
|
||||
},
|
||||
exclude: /node_modules/,
|
||||
}
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue