Skip to content

Commit f8db562

Browse files
committed
BREAKING CHANGE: updated to Angular 6, ngx-bootstrap 3, ngx-datatable 13, rxjs 6, and webpack 4
Dropped the tree-list component due to Angular 6 issues with mobx autorun, introduced by angular-tree-component. See patternfly/patternfly-ng#381
1 parent cfe146f commit f8db562

38 files changed

+331
-1784
lines changed

config/webpack.common.js

+60-64
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,9 @@ const path = require('path'),
99
/**
1010
* Webpack Plugins
1111
*/
12-
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
13-
const DefinePlugin = require('webpack/lib/DefinePlugin');
1412
const ExtractTextPlugin = require('extract-text-webpack-plugin');
1513
const HtmlWebpackPlugin = require('html-webpack-plugin');
16-
const IgnorePlugin = require('webpack/lib/IgnorePlugin');
17-
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
18-
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');
1914
const OptimizeJsPlugin = require('optimize-js-plugin');
20-
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
21-
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
2215

2316
// ExtractTextPlugin
2417
const extractCSS = new ExtractTextPlugin({
@@ -41,57 +34,72 @@ module.exports = {
4134
module: {
4235
rules: [
4336
{
44-
enforce: 'pre',
4537
test: /\.ts$/,
38+
enforce: 'pre',
4639
use: 'tslint-loader',
4740
exclude: [helpers.root('node_modules')]
4841
},
4942
{
5043
test: /\.ts$/,
5144
use: [
52-
{
53-
loader: 'awesome-typescript-loader',
54-
options: {
55-
declaration: false
56-
}
57-
},
58-
{
59-
loader: 'angular2-template-loader'
60-
}
45+
// 'awesome-typescript-loader',
46+
'ts-loader',
47+
'angular2-template-loader'
6148
],
6249
exclude: [/\.spec\.ts$/]
63-
},{
50+
},
51+
52+
/*
53+
* to string and css loader support for *.css files
54+
* Returns file content as string
55+
*
56+
*/
57+
{
6458
test: /\.css$/,
65-
loader: extractCSS.extract({
59+
use: extractCSS.extract({
6660
fallback: "style-loader",
67-
use: "css-loader?sourceMap&context=/"
61+
use: [
62+
{
63+
loader: 'css-loader',
64+
options: {
65+
sourceMap: true,
66+
context: '/'
67+
},
68+
},
69+
]
6870
})
6971
},
7072

71-
/* File loader for supporting fonts, for example, in CSS files.
73+
/**
74+
* File loader for supporting fonts, for example, in CSS files.
7275
*/
7376
{
74-
test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/,
75-
loaders: [
76-
{
77-
loader: "url-loader",
78-
query: {
79-
limit: 3000,
80-
name: 'assets/fonts/[name].[ext]'
81-
}
77+
test: /\.(woff2|woff|ttf|eot|svg)$/,
78+
use: {
79+
loader: 'url-loader',
80+
query: {
81+
limit: 3000,
82+
// includePaths: [
83+
// path.resolve(__dirname, "../node_modules/patternfly/dist/fonts/")
84+
// ],
85+
name: 'assets/fonts/[name].[ext]'
8286
}
83-
]
84-
}, {
85-
test: /\.jpg$|\.png$|\.gif$|\.jpeg$/,
86-
loaders: [
87-
{
88-
loader: "url-loader",
89-
query: {
90-
limit: 3000,
91-
name: 'assets/fonts/[name].[ext]'
92-
}
87+
},
88+
exclude: path.resolve(__dirname, "../src/demo/images/")
89+
},
90+
{
91+
test: /\.(jpg|png|svg|gif|jpeg)$/,
92+
use: {
93+
loader: 'url-loader',
94+
query: {
95+
limit: 3000,
96+
includePaths: [
97+
path.resolve(__dirname, "../src/assets/images/")
98+
],
99+
name: 'assets/images/[name].[ext]'
93100
}
94-
]
101+
},
102+
exclude: path.resolve(__dirname, "../node_modules/patternfly/dist/fonts/")
95103
},
96104

97105
// Support for *.json files.
@@ -108,6 +116,18 @@ module.exports = {
108116
]
109117
},
110118

119+
optimization: {
120+
splitChunks: {
121+
cacheGroups: {
122+
commons: {
123+
test: /[\\/]node_modules[\\/]/,
124+
name: "vendors",
125+
chunks: "all"
126+
}
127+
}
128+
}
129+
},
130+
111131
plugins: [
112132
/**
113133
* Plugin: ContextReplacementPlugin
@@ -141,7 +161,6 @@ module.exports = {
141161
*
142162
* See: https://github.com/webpack/extract-text-webpack-plugin
143163
*/
144-
// new ExtractTextPlugin('[name].[contenthash].css'),
145164
new ExtractTextPlugin('[name].css'),
146165

147166
new webpack.LoaderOptionsPlugin({
@@ -151,19 +170,6 @@ module.exports = {
151170
*
152171
* See: https://github.com/webpack/html-loader#advanced-options
153172
*/
154-
// TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor
155-
// htmlLoader: {
156-
// minimize: true,
157-
// removeAttributeQuotes: false,
158-
// caseSensitive: true,
159-
// customAttrSurround: [
160-
// [/#/, /(?:)/],
161-
// [/\*/, /(?:)/],
162-
// [/\[?\(?/, /(?:)/]
163-
// ],
164-
// customAttrAssign: [/\)?\]?=/]
165-
// },
166-
167173
tslintLoader: {
168174
emitErrors: false,
169175
failOnHint: false
@@ -174,20 +180,10 @@ module.exports = {
174180
// Only emit files when there are no errors
175181
new webpack.NoEmitOnErrorsPlugin(),
176182

177-
// // Reference: http://webpack.github.io/docs/list-of-plugins.html#dedupeplugin
178-
// // Dedupe modules in the output
179-
// new webpack.optimize.DedupePlugin(),
180-
181183
// Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
182184
// Minify all javascript, switch loaders to minimizing mode
183185
// new webpack.optimize.UglifyJsPlugin({sourceMap: true, mangle: { keep_fnames: true }}),
184186

185-
// Copy assets from the public folder
186-
// Reference: https://github.com/kevlened/copy-webpack-plugin
187-
// new CopyWebpackPlugin([{
188-
// from: helpers.root('src/public')
189-
// }]),
190-
191187
// Reference: https://github.com/johnagan/clean-webpack-plugin
192188
// Removes the bundle folder before the build
193189
new CleanWebpackPlugin(['bundles'], {

0 commit comments

Comments
 (0)