Commit 8f207597 authored by 神楽坂玲奈's avatar 神楽坂玲奈

AOT compile

因为没调教好相对路径,暂时把 MyCardProduct.png 移至根目录
parent e72184a4
......@@ -9,3 +9,7 @@ e2e/**/*.js
e2e/**/*.js.map
_test-output
_temp
/aot/
!/aot/index.html
!/aot/bs-config.json
{
"port": 8000,
"files": ["./aot/**/*.{html,htm,css,js}"],
"server": { "baseDir": "./aot" }
}
<!DOCTYPE html>
<html>
<head>
<base href="/">
<title>MyCard - 萌卡</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<script src="shim.min.js"></script>
<script src="zone.min.js"></script>
<script>window.module = 'aot';</script>
</head>
<body>
<store>Loading...</store>
</body>
<script src="dist/build.js"></script>
</html>
import {platformBrowser} from '@angular/platform-browser';
import {StoreModuleNgFactory} from '../aot/app/store.module.ngfactory';
import {enableProdMode} from '@angular/core';
enableProdMode();
platformBrowser().bootstrapModuleFactory(StoreModuleNgFactory);
......@@ -36,7 +36,7 @@
<a href="https://wudizhanche.mycard.moe/download?platform=darwin">Mac</a> 操作系统。</p>
</div>
<div class="col">
<img id="pic" src="images/MyCardProduct.png">
<img id="pic" src="MyCardProduct.png">
</div>
</div>
</div>
......
var fs = require('fs');
var resources = [
'node_modules/core-js/client/shim.min.js',
'node_modules/zone.js/dist/zone.min.js',
'styles.css',
'node_modules/bootstrap/dist/css/bootstrap.min.css',
'MyCardProduct.png'
];
resources.map(function(f) {
var path = f.split('/');
var t = 'aot/' + path[path.length-1];
fs.createReadStream(f).pipe(fs.createWriteStream(t));
});
......@@ -11,7 +11,10 @@
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w"
"tsc:w": "tsc -w",
"start:aot": "build:aot && lite:aot",
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup-config.js && node copy-dist-files",
"lite:aot": "lite-server -c aot/bs-config.json"
},
"keywords": [],
"author": "",
......@@ -27,7 +30,7 @@
"@angular/router": "latest",
"@types/bootstrap": "latest",
"@types/jquery": "latest",
"@types/node": "latest",
"@types/node": "^7.0.1",
"@types/tether": "latest",
"angular-in-memory-web-api": "latest",
"bootstrap": "next",
......@@ -39,9 +42,15 @@
"zone.js": "^0.7.4"
},
"devDependencies": {
"@angular/compiler-cli": "^2.4.4",
"@angular/platform-server": "^2.4.4",
"lite-server": "latest",
"typescript": "latest",
"tslint": "^3.15.1"
"rollup": "^0.41.4",
"rollup-plugin-commonjs": "^7.0.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1",
"tslint": "^3.15.1",
"typescript": "latest"
},
"repository": {}
}
import rollup from 'rollup'
import nodeResolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify'
//paths are relative to the execution path
export default {
entry: 'app/main-aot.js',
dest: 'aot/dist/build.js', // output a single application bundle
sourceMap: true,
sourceMapFile: 'aot/dist/build.js.map',
format: 'iife',
plugins: [
nodeResolve({jsnext: true, module: true}),
commonjs({
include: ['node_modules/rxjs/**']
}),
uglify()
]
}
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/@types/"
]
},
"files": [
"app/store.module.ts",
"app/main-aot.ts"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment