annotate config/webpack.common.js @ 62:7787ca310644 webpack tip

update @angular to 4.4.5.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Wed, 18 Oct 2017 17:46:41 +0200
parents 7b9d616695d3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
1 var webpack = require('webpack');
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
2 var HtmlWebpackPlugin = require('html-webpack-plugin');
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
3 var ExtractTextPlugin = require('extract-text-webpack-plugin');
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
4 var helpers = require('./helpers');
62
7787ca310644 update @angular to 4.4.5.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 60
diff changeset
5 //var path = require('path')
7787ca310644 update @angular to 4.4.5.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 60
diff changeset
6 //var webpackLinkPlugin = require('webpack-link');
60
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
7
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
8 module.exports = {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
9 entry: {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
10 'polyfills': './src/polyfills.ts',
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
11 'vendor': './src/vendor.ts',
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
12 'app': './src/main.ts'
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
13 },
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
14
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
15 resolve: {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
16 extensions: ['.ts', '.js']
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
17 },
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
18
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
19 module: {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
20 rules: [
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
21 {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
22 test: /\.ts$/,
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
23 loaders: [
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
24 {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
25 loader: 'awesome-typescript-loader',
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
26 options: { configFileName: helpers.root('src', 'tsconfig.json') }
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
27 } , 'angular2-template-loader'
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
28 ]
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
29 },
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
30 {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
31 test: /\.html$/,
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
32 loader: 'html-loader'
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
33 },
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
34 {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
35 test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
36 loader: 'file-loader?name=assets/[name].[hash].[ext]'
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
37 },
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
38 {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
39 test: /\.css$/,
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
40 exclude: helpers.root('src', 'app'),
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
41 loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader?sourceMap' })
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
42 },
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
43 {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
44 test: /\.css$/,
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
45 include: helpers.root('src', 'app'),
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
46 loader: 'raw-loader'
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
47 }
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
48 ]
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
49 },
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
50
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
51 plugins: [
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
52 // Workaround for angular/angular#11580
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
53 new webpack.ContextReplacementPlugin(
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
54 // The (\\|\/) piece accounts for path separators in *nix and Windows
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
55 /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
56 helpers.root('./src'), // location of your src
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
57 {} // a map of your routes
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
58 ),
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
59
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
60 new webpack.optimize.CommonsChunkPlugin({
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
61 name: ['app', 'vendor', 'polyfills']
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
62 }),
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
63
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
64 new HtmlWebpackPlugin({
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
65 template: 'src/index.html'
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
66 })
62
7787ca310644 update @angular to 4.4.5.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 60
diff changeset
67
7787ca310644 update @angular to 4.4.5.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 60
diff changeset
68 // new webpackLinkPlugin({
7787ca310644 update @angular to 4.4.5.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 60
diff changeset
69 // localModule: path.resolve(__dirname, '../ng2-table')
7787ca310644 update @angular to 4.4.5.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 60
diff changeset
70 // })
60
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
71 ]
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
72 };