Skip to content
This repository has been archived by the owner on Jan 18, 2019. It is now read-only.

Commit

Permalink
feat(AoT-build): Basic support for AoT build, see #31
Browse files Browse the repository at this point in the history
  • Loading branch information
hypery2k committed May 24, 2017
1 parent 133d4ef commit 60f389f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions etc/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var appConfig = {
title: 'AngularCommon',
dir: 'dist/test-reports'
},
entryModule: path.resolve(sourceRoot, 'app/app.module#AppModule'),
copy: [],
indexFiles: [{
chunks: ['main', 'polyfills', 'vendor'],
Expand Down
9 changes: 6 additions & 3 deletions etc/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var config = {
*
* See: http://webpack.github.io/docs/configuration.html#resolve-extensions
*/
extensions: ['.ts', '.js', '.json'],
extensions: ['.aot.ts', '.ts', '.js', '.json'],

// Make sure root is src
modules: [
Expand Down Expand Up @@ -137,7 +137,7 @@ var config = {
{
test: /\.ts$/,
loader: 'string-replace-loader',
query: {
options: {
search: '(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import\\((.+)\\)',
replace: '$1.import($3).then(mod => (mod.__esModule && mod.default) ? mod.default : mod)',
flags: 'g'
Expand Down Expand Up @@ -190,7 +190,10 @@ var config = {
*/
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader']
loaders: [
'awesome-typescript-loader',
"@ngtools/webpack"
]
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
Expand Down
9 changes: 9 additions & 0 deletions etc/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const IgnorePlugin = webpack.IgnorePlugin;
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
const WebpackMd5Hash = require('webpack-md5-hash');
const OfflinePlugin = require('offline-plugin');
const AotPlugin = require("@ngtools/webpack").AotPlugin;

/**
* Webpack Constants
Expand Down Expand Up @@ -196,6 +197,14 @@ let config = webpackMerge(commonConfig, {
// threshold: 2 * 1024
// })


// Angular AOT compiler
new AotPlugin({
tsConfigPath: "tsconfig.aot.json",
entryModule: appConfig.entryModule,
typeChecking: false
}),

]

});
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
"release:major": "npm version major && npm run release:pre && git push origin && git push origin --tags && npm run release:post && npm run version-and-push",
"release:minor": "npm version minor && npm run release:pre && git push origin && git push origin --tags && npm run release:post && npm run version-and-push",
"release:patch": "npm version patch && npm run release:pre && git push origin && git push origin --tags && npm run release:post && npm run version-and-push",
"version-and-push": "git push origin && git push origin --tags && npm run publish-and-merge",
"version-and-push": "git push origin && git push origin --tags && npm run publish-and-merge"
},
"dependencies": {
"@angular/tsc-wrapped": "4.0.3",
"@ngtools/webpack": "1.2.10",
"@types/core-js": "0.9.37",
"@types/jasmine": "2.5.46",
"@types/node": "7.0.8",
Expand Down Expand Up @@ -90,6 +92,7 @@
"devDependencies": {
"@angular/common": "4.0.3",
"@angular/compiler": "4.0.3",
"@angular/compiler-cli": "4.0.3",
"@angular/core": "4.0.3",
"@angular/forms": "4.0.3",
"@angular/http": "4.0.3",
Expand All @@ -109,6 +112,7 @@
"peerDependencies": {
"@angular/common": "^4.0.3",
"@angular/compiler": "^4.0.3",
"@angular/compiler-cli": "4.0.3",
"@angular/core": "^4.0.3",
"@angular/forms": "^4.0.3",
"@angular/http": "^4.0.3",
Expand Down

0 comments on commit 60f389f

Please sign in to comment.