Skip to content

Commit 0ee8b40

Browse files
authored
Upgrade Aurelia project based on the latest from JavaScript Services. Also cleaned up a couple of Angular issues.
1 parent fa8b06b commit 0ee8b40

37 files changed

+253561
-85686
lines changed

ASP.NET Core Basics/src/Angular/ClientApp/dist/89889688147bd7575d6327160d64e760.svg

Lines changed: 288 additions & 0 deletions
Loading

ASP.NET Core Basics/src/Angular/ClientApp/dist/main-server.js

Lines changed: 8012 additions & 586 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASP.NET Core Basics/src/Angular/ClientApp/dist/vendor-manifest.json

Lines changed: 569 additions & 0 deletions
Large diffs are not rendered by default.

ASP.NET Core Basics/src/Angular/ClientApp/dist/vendor.js

Lines changed: 101498 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 67 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,71 @@
1-
var isDevBuild = process.argv.indexOf('--env.prod') < 0;
2-
var path = require('path');
3-
var webpack = require('webpack');
4-
var nodeExternals = require('webpack-node-externals');
5-
var merge = require('webpack-merge');
6-
var allFilenamesExceptJavaScript = /\.(?!js(\?|$))([^.]+(\?|$))/;
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
const merge = require('webpack-merge');
4+
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
75

8-
// Configuration in common to both client-side and server-side bundles
9-
var sharedConfig = {
10-
resolve: { extensions: [ '', '.js', '.ts' ] },
11-
output: {
12-
filename: '[name].js',
13-
publicPath: '/dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
14-
},
15-
module: {
16-
loaders: [
17-
{ test: /\.ts$/, include: /ClientApp/, loader: 'ts', query: { silent: true } },
18-
{ test: /\.html$/, loader: 'raw' },
19-
{ test: /\.css$/, loader: 'to-string!css' },
20-
{ test: /\.(png|jpg|jpeg|gif|svg)$/, loader: 'url', query: { limit: 25000 } }
21-
]
22-
}
23-
};
6+
module.exports = (env) => {
7+
// Configuration in common to both client-side and server-side bundles
8+
const isDevBuild = !(env && env.prod);
9+
const sharedConfig = {
10+
stats: { modules: false },
11+
context: __dirname,
12+
resolve: { extensions: ['.js', '.ts'] },
13+
output: {
14+
filename: '[name].js',
15+
publicPath: '/dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
16+
},
17+
module: {
18+
rules: [
19+
{ test: /\.ts$/, include: /ClientApp/, use: ['awesome-typescript-loader?silent=true', 'angular2-template-loader'] },
20+
{ test: /\.html$/, use: 'html-loader?minimize=false' },
21+
{ test: /\.css$/, use: ['to-string-loader', 'css-loader'] },
22+
{ test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' }
23+
]
24+
},
25+
plugins: [new CheckerPlugin()]
26+
};
2427

25-
// Configuration for client-side bundle suitable for running in browsers
26-
var clientBundleOutputDir = './wwwroot/dist';
27-
var clientBundleConfig = merge(sharedConfig, {
28-
entry: { 'main-client': './ClientApp/boot-client.ts' },
29-
output: { path: path.join(__dirname, clientBundleOutputDir) },
30-
plugins: [
31-
new webpack.DllReferencePlugin({
32-
context: __dirname,
33-
manifest: require('./wwwroot/dist/vendor-manifest.json')
34-
})
35-
].concat(isDevBuild ? [
36-
// Plugins that apply in development builds only
37-
new webpack.SourceMapDevToolPlugin({
38-
filename: '[file].map', // Remove this line if you prefer inline source maps
39-
moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
40-
})
41-
] : [
42-
// Plugins that apply in production builds only
43-
new webpack.optimize.OccurenceOrderPlugin(),
44-
new webpack.optimize.UglifyJsPlugin()
45-
])
46-
});
28+
// Configuration for client-side bundle suitable for running in browsers
29+
const clientBundleOutputDir = './wwwroot/dist';
30+
const clientBundleConfig = merge(sharedConfig, {
31+
entry: { 'main-client': './ClientApp/boot-client.ts' },
32+
output: { path: path.join(__dirname, clientBundleOutputDir) },
33+
plugins: [
34+
new webpack.DllReferencePlugin({
35+
context: __dirname,
36+
manifest: require('./wwwroot/dist/vendor-manifest.json')
37+
})
38+
].concat(isDevBuild ? [
39+
// Plugins that apply in development builds only
40+
new webpack.SourceMapDevToolPlugin({
41+
filename: '[file].map', // Remove this line if you prefer inline source maps
42+
moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
43+
})
44+
] : [
45+
// Plugins that apply in production builds only
46+
new webpack.optimize.UglifyJsPlugin()
47+
])
48+
});
4749

48-
// Configuration for server-side (prerendering) bundle suitable for running in Node
49-
var serverBundleConfig = merge(sharedConfig, {
50-
entry: { 'main-server': './ClientApp/boot-server.ts' },
51-
output: {
52-
libraryTarget: 'commonjs',
53-
path: path.join(__dirname, './ClientApp/dist')
54-
},
55-
target: 'node',
56-
devtool: 'inline-source-map',
57-
externals: [nodeExternals({ whitelist: [allFilenamesExceptJavaScript] })] // Don't bundle .js files from node_modules
58-
});
50+
// Configuration for server-side (prerendering) bundle suitable for running in Node
51+
const serverBundleConfig = merge(sharedConfig, {
52+
resolve: { mainFields: ['main'] },
53+
entry: { 'main-server': './ClientApp/boot-server.ts' },
54+
plugins: [
55+
new webpack.DllReferencePlugin({
56+
context: __dirname,
57+
manifest: require('./ClientApp/dist/vendor-manifest.json'),
58+
sourceType: 'commonjs2',
59+
name: './vendor'
60+
})
61+
],
62+
output: {
63+
libraryTarget: 'commonjs',
64+
path: path.join(__dirname, './ClientApp/dist')
65+
},
66+
target: 'node',
67+
devtool: 'inline-source-map'
68+
});
5969

60-
module.exports = [clientBundleConfig, serverBundleConfig];
70+
return [clientBundleConfig, serverBundleConfig];
71+
};
Lines changed: 85 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,88 @@
1-
var isDevBuild = process.argv.indexOf('--env.prod') < 0;
2-
var path = require('path');
3-
var webpack = require('webpack');
4-
var ExtractTextPlugin = require('extract-text-webpack-plugin');
5-
var extractCSS = new ExtractTextPlugin('vendor.css');
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
4+
const merge = require('webpack-merge');
65

7-
module.exports = {
8-
resolve: {
9-
extensions: [ '', '.js' ]
10-
},
11-
module: {
12-
loaders: [
13-
{ test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, loader: 'url-loader?limit=100000' },
14-
{ test: /\.css(\?|$)/, loader: extractCSS.extract(['css']) }
6+
module.exports = (env) => {
7+
const extractCSS = new ExtractTextPlugin('vendor.css');
8+
const isDevBuild = !(env && env.prod);
9+
const sharedConfig = {
10+
stats: { modules: false },
11+
resolve: { extensions: ['.js'] },
12+
module: {
13+
rules: [
14+
{ test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, use: 'url-loader?limit=100000' }
15+
]
16+
},
17+
entry: {
18+
vendor: [
19+
'@angular/common',
20+
'@angular/compiler',
21+
'@angular/core',
22+
'@angular/http',
23+
'@angular/platform-browser',
24+
'@angular/platform-browser-dynamic',
25+
'@angular/router',
26+
'@angular/platform-server',
27+
'angular2-universal',
28+
'angular2-universal-polyfills',
29+
'bootstrap',
30+
'bootstrap/dist/css/bootstrap.css',
31+
'es6-shim',
32+
'es6-promise',
33+
'event-source-polyfill',
34+
'jquery',
35+
'zone.js',
36+
]
37+
},
38+
output: {
39+
publicPath: '/dist/',
40+
filename: '[name].js',
41+
library: '[name]_[hash]'
42+
},
43+
plugins: [
44+
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
45+
new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/11580
46+
new webpack.IgnorePlugin(/^vertx$/) // Workaround for https://github.com/stefanpenner/es6-promise/issues/100
1547
]
16-
},
17-
entry: {
18-
vendor: [
19-
'@angular/common',
20-
'@angular/compiler',
21-
'@angular/core',
22-
'@angular/http',
23-
'@angular/platform-browser',
24-
'@angular/platform-browser-dynamic',
25-
'@angular/router',
26-
'@angular/platform-server',
27-
'angular2-universal',
28-
'angular2-universal-polyfills',
29-
'bootstrap',
30-
'bootstrap/dist/css/bootstrap.css',
31-
'es6-shim',
32-
'es6-promise',
33-
'event-source-polyfill',
34-
'jquery',
35-
'zone.js',
48+
};
49+
50+
const clientBundleConfig = merge(sharedConfig, {
51+
output: { path: path.join(__dirname, 'wwwroot', 'dist') },
52+
module: {
53+
rules: [
54+
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: 'css-loader' }) }
55+
]
56+
},
57+
plugins: [
58+
extractCSS,
59+
new webpack.DllPlugin({
60+
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
61+
name: '[name]_[hash]'
62+
})
63+
].concat(isDevBuild ? [] : [
64+
new webpack.optimize.UglifyJsPlugin()
65+
])
66+
});
67+
68+
const serverBundleConfig = merge(sharedConfig, {
69+
target: 'node',
70+
resolve: { mainFields: ['main'] },
71+
output: {
72+
path: path.join(__dirname, 'ClientApp', 'dist'),
73+
libraryTarget: 'commonjs2',
74+
},
75+
module: {
76+
rules: [{ test: /\.css(\?|$)/, use: ['to-string-loader', 'css-loader'] }]
77+
},
78+
entry: { vendor: ['aspnet-prerendering'] },
79+
plugins: [
80+
new webpack.DllPlugin({
81+
path: path.join(__dirname, 'ClientApp', 'dist', '[name]-manifest.json'),
82+
name: '[name]_[hash]'
83+
})
3684
]
37-
},
38-
output: {
39-
path: path.join(__dirname, 'wwwroot', 'dist'),
40-
filename: '[name].js',
41-
library: '[name]_[hash]',
42-
},
43-
plugins: [
44-
extractCSS,
45-
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
46-
new webpack.optimize.OccurenceOrderPlugin(),
47-
new webpack.DllPlugin({
48-
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
49-
name: '[name]_[hash]'
50-
})
51-
].concat(isDevBuild ? [] : [
52-
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } })
53-
])
54-
};
85+
});
86+
87+
return [clientBundleConfig, serverBundleConfig];
88+
}

0 commit comments

Comments
 (0)