|
System.config({
transpiler: "ts",
typescriptOptions: {
target: "es5",
module: "commonjs",
moduleResolution: "node",
emitDecoratorMetadata: true,
experimentalDecorators: true,
},
meta: {
'typescript': {
"exports": "ts"
}
},
paths: {
"syncfusion:": "//cdn.syncfusion.com/ej2/"
},
map: {
app: 'app',
"@syncfusion/ej2-base": "syncfusion:ej2-base/dist/ej2-base.umd.min.js",
"@syncfusion/ej2-buttons": "syncfusion:ej2-buttons/dist/ej2-buttons.umd.min.js"
},
packages: {
'app': { main: 'index', defaultExtension: 'ts' }
}
});
System.import('app');
|
|
"devDependencies": {
"terser-webpack-plugin": "^2.3.5",
"ts-loader": "^7.0.1",
"typescript": "^3.8.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
"dependencies": {
"@syncfusion/ej2-buttons": "*"
}
|
|
{
"compilerOptions": {
"target": "es5",
"module": "amd",
"declaration": true,
"removeComments": true,
"noLib": false,
"experimentalDecorators": true,
"sourceMap": true,
"pretty": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"allowJs": false,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"suppressImplicitAnyIndexErrors": true,
"lib": [ "es2015.collection", "es2015.core", "es5", "es2015.promise", "dom" ],
"types": []
},
"exclude": [
"node_modules"
],
"compileOnSave": false
}
|
|
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
mode: 'development',
entry: path.join(__dirname, '/app.ts'),
output: {
filename: 'app.js',
path: __dirname
},
devtool: false,
optimization: {
minimize: false,
minimizer: [new TerserPlugin(
{ parallel: true, }
)],
usedExports: true,
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
},
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"]
},
};
|
|
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build">
<Exec Command="npm install" />
<Exec Command="webpack" />
</Target>
|
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>TypeScript HTML App</title>
<link rel="stylesheet" rel='nofollow' href="app.css" type="text/css" />
</head>
<body>
<h1>TypeScript HTML App</h1>
<button id="normalbtn">Normal</button>
<script src="app.js"></script>
</body>
</html>
|
|
import { Button } from '@syncfusion/ej2-buttons';
// initialize button control
let button: Button = new Button();
// render initialized button
button.appendTo('#normalbtn');
|