update config files with the lattest changes form angular-universal-starter project, ignore node_modules and dist folders

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@43768 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-09-22 11:22:23 +00:00
parent bf77522917
commit d0e77c8f64
4 changed files with 49 additions and 11 deletions

View File

@ -13,7 +13,9 @@
"build:prod": "webpack --progress -p", "build:prod": "webpack --progress -p",
"prestart": "npm run build", "prestart": "npm run build",
"server": "nodemon dist/server/index.js", "server": "nodemon dist/server/index.js",
"debug:server": "node-nightly --inspect --debug-brk dist/server/index.js",
"start": "npm run server", "start": "npm run server",
"debug:start": "npm run build && npm run debug:server",
"predebug": "npm run build", "predebug": "npm run build",
"debug:build": "node-nightly --inspect --debug-brk node_modules/webpack/bin/webpack.js", "debug:build": "node-nightly --inspect --debug-brk node_modules/webpack/bin/webpack.js",
"debug": "node --debug-brk dist/server/index.js" "debug": "node --debug-brk dist/server/index.js"
@ -36,15 +38,15 @@
"@angular/platform-browser-dynamic": "2.0.0", "@angular/platform-browser-dynamic": "2.0.0",
"@angular/platform-server": "2.0.0", "@angular/platform-server": "2.0.0",
"@angular/router": "3.0.0", "@angular/router": "3.0.0",
"angular2-platform-node": "~2.0.4", "angular2-platform-node": "~2.0.11",
"angular2-universal": "~2.0.4", "angular2-universal": "~2.0.11",
"angular2-universal-polyfills": "~2.0.4", "angular2-universal-polyfills": "~2.0.11",
"angular2-express-engine": "~2.0.4", "angular2-express-engine": "~2.0.11",
"body-parser": "^1.15.2", "body-parser": "^1.15.2",
"express": "^4.14.0", "express": "^4.14.0",
"methods": "~1.1.2", "methods": "~1.1.2",
"rxjs": "5.0.0-beta.12", "rxjs": "5.0.0-beta.12",
"zone.js": "~0.6.21" "zone.js": "0.6.21"
}, },
"devDependencies": { "devDependencies": {
"@angularclass/resolve-angular-routes": "^1.0.9", "@angularclass/resolve-angular-routes": "^1.0.9",
@ -53,19 +55,22 @@
"@types/cookie-parser": "^1.3.29", "@types/cookie-parser": "^1.3.29",
"@types/express": "^4.0.32", "@types/express": "^4.0.32",
"@types/express-serve-static-core": "^4.0.33", "@types/express-serve-static-core": "^4.0.33",
"@types/hammerjs": "^2.0.32",
"@types/mime": "0.0.28", "@types/mime": "0.0.28",
"@types/node": "^6.0.38", "@types/node": "^6.0.38",
"@types/serve-static": "^1.7.27", "@types/serve-static": "^1.7.27",
"angular2-template-loader": "^0.4.0", "angular2-template-loader": "^0.4.0",
"cookie-parser": "^1.4.3", "cookie-parser": "^1.4.3",
"imports-loader": "^0.6.5",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"nodemon": "^1.10.0", "nodemon": "^1.10.0",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"string-replace-loader": "github:gdi2290/string-replace-loader",
"ts-loader": "^0.8.2", "ts-loader": "^0.8.2",
"ts-node": "^1.3.0", "ts-node": "^1.3.0",
"typescript": "2.0.0", "typescript": "2.0.0",
"webpack": "^2.1.0-beta.22", "webpack": "2.1.0-beta.22",
"webpack-dev-middleware": "^1.6.1", "webpack-dev-middleware": "^1.6.1",
"webpack-dev-server": "^2.1.0-beta.0", "webpack-dev-server": "^2.1.0-beta.0",
"webpack-merge": "^0.13.0" "webpack-merge": "^0.13.0"

View File

@ -47,7 +47,7 @@ function ngApp(req, res) {
preboot: false, preboot: false,
baseUrl: '/', baseUrl: '/',
requestUrl: req.originalUrl, requestUrl: req.originalUrl,
originUrl: req.hostname originUrl: 'http://localhost:3000'
}); });
} }
// Routes with html5pushstate // Routes with html5pushstate

View File

@ -18,7 +18,8 @@
"express-serve-static-core", "express-serve-static-core",
"mime", "mime",
"node", "node",
"serve-static" "serve-static",
"hammerjs"
] ]
}, },
"exclude": [ "exclude": [

View File

@ -8,8 +8,6 @@ var commonConfig = {
extensions: ['', '.ts', '.js', '.json'] extensions: ['', '.ts', '.js', '.json']
}, },
module: { module: {
preLoaders: [
],
loaders: [ loaders: [
// TypeScript // TypeScript
{ test: /\.ts$/, loaders: ['ts-loader', 'angular2-template-loader'] }, { test: /\.ts$/, loaders: ['ts-loader', 'angular2-template-loader'] },
@ -53,7 +51,33 @@ var serverConfig = {
path: root('dist/server'), path: root('dist/server'),
libraryTarget: 'commonjs2' libraryTarget: 'commonjs2'
}, },
externals: checkNodeImport, module: {
preLoaders: [
{ test: /angular2-material/, loader: "imports-loader?window=>global" }
],
},
externals: includeClientPackages([
// include these client packages so we can transform their source with webpack loaders
'@angular2-material/button',
'@angular2-material/button',
'@angular2-material/card',
'@angular2-material/checkbox',
'@angular2-material/core',
'@angular2-material/grid',
'@angular2-material/icon',
'@angular2-material/input',
'@angular2-material/list',
'@angular2-material/menu',
'@angular2-material/progress',
'@angular2-material/progress',
'@angular2-material/radio',
'@angular2-material/sidenav',
'@angular2-material/slider',
'@angular2-material/slide',
'@angular2-material/tabs',
'@angular2-material/toolbar',
'@angular2-material/tooltip'
]),
node: { node: {
global: true, global: true,
__dirname: true, __dirname: true,
@ -88,6 +112,14 @@ module.exports = [
webpackMerge({}, defaultConfig, commonConfig, serverConfig) webpackMerge({}, defaultConfig, commonConfig, serverConfig)
]; ];
function includeClientPackages(packages) {
return function(context, request, cb) {
if (packages && packages.indexOf(request) !== -1) {
return cb();
}
return checkNodeImport(context, request, cb);
};
}
// Helpers // Helpers
function checkNodeImport(context, request, cb) { function checkNodeImport(context, request, cb) {
if (!path.isAbsolute(request) && request.charAt(0) !== '.') { if (!path.isAbsolute(request) && request.charAt(0) !== '.') {