Resolve package security concerns by upgrading to webpack 4

This commit is contained in:
Travis Ralston 2018-12-08 22:36:25 -07:00
parent 9d88e59aae
commit e2bbe71d06
3 changed files with 1565 additions and 1225 deletions

2706
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,7 @@
"start:web": "webpack-dev-server --inline --progress --port 8080 --host 0.0.0.0",
"start:app": "npm run-script build && node build/app/index.js",
"build": "npm run-script build:web && npm run-script build:app",
"build:web": "rimraf build/web && webpack --progress --profile --bail",
"build:web": "rimraf build/web && webpack --mode production --progress --profile --bail",
"build:app": "rimraf build/app && tsc -p tsconfig-app.json",
"lint": "npm run-script lint:app && npm run-script lint:web",
"lint:app": "tslint --project ./tsconfig-app.json -t stylish",
@ -41,7 +41,7 @@
"sequelize": "^4.39.1",
"sequelize-typescript": "^0.6.6",
"spotify-uri": "^1.0.0",
"sqlite3": "^4.0.2",
"sqlite3": "^4.0.4",
"typescript": "^2.9.2",
"typescript-rest": "^1.7.0",
"umzug": "^2.1.0",
@ -68,21 +68,21 @@
"angular2-template-loader": "^0.6.2",
"angular2-toaster": "^4.0.2",
"angular2-ui-switch": "^1.2.0",
"awesome-typescript-loader": "^3.5.0",
"awesome-typescript-loader": "^5.2.1",
"codelyzer": "^4.5.0",
"copy-webpack-plugin": "^4.5.3",
"copy-webpack-plugin": "^4.6.0",
"core-js": "^2.5.7",
"css-loader": "^0.28.11",
"css-loader": "^2.0.0",
"cssnano": "^3.10.0",
"dom-to-image": "^2.6.0",
"embed-video": "^2.0.4",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.11",
"goby": "^1.1.2",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^2.28.0",
"html-webpack-plugin": "^3.2.0",
"jquery": "^3.3.1",
"json-loader": "^0.5.4",
"json-loader": "^0.5.7",
"mini-css-extract-plugin": "^0.5.0",
"ng2-breadcrumbs": "^0.1.281",
"ngx-modialog": "5.0.0",
"node-sass": "^4.9.4",
@ -94,17 +94,18 @@
"reflect-metadata": "^0.1.12",
"rimraf": "^2.6.2",
"rxjs": "^5.5.12",
"sass-loader": "^6.0.7",
"sass-loader": "^7.1.0",
"screenfull": "^3.3.3",
"shelljs": "^0.7.8",
"shelljs": "^0.8.3",
"spinkit": "^1.2.5",
"style-loader": "^0.19.1",
"style-loader": "^0.23.1",
"ts-helpers": "^1.1.2",
"tslint": "^5.11.0",
"tslint-loader": "^3.6.0",
"url-loader": "^0.6.2",
"webpack": "^3.12.0",
"webpack-dev-server": "^2.11.3",
"tslint-loader": "^3.5.4",
"url-loader": "^1.1.2",
"webpack": "^4.27.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10",
"zone.js": "^0.8.26"
}
}

View file

@ -1,12 +1,11 @@
var path = require("path");
var webpack = require("webpack");
const path = require("path");
const webpack = require("webpack");
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
var isProd = process.env.npm_lifecycle_event.startsWith('build');
const isProd = process.env.npm_lifecycle_event.startsWith('build');
module.exports = function () {
var config = {};
@ -42,14 +41,17 @@ module.exports = function () {
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader?name=fonts/[name].[hash].[ext]?'
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.css$/,
exclude: root('web', 'app'),
loader: ExtractTextPlugin.extract({fallback: 'style-loader', use: ['css-loader', 'postcss-loader']})
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {}
},
"css-loader",
"postcss-loader"
]
},
{
test: /\.css$/,
@ -58,10 +60,15 @@ module.exports = function () {
{
test: /\.(scss|sass)$/,
exclude: root('web', 'app'),
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader', 'sass-loader']
})
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {}
},
"css-loader",
"postcss-loader",
"sass-loader"
]
},
{
test: /\.(scss|sass)$/,
@ -88,7 +95,8 @@ module.exports = function () {
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
root('./web') // location of your src
), new webpack.LoaderOptionsPlugin({
),
new webpack.LoaderOptionsPlugin({
options: {
tslint: {
emitErrors: false,
@ -99,19 +107,18 @@ module.exports = function () {
}
}
}),
new CommonsChunkPlugin({
name: ['vendor', 'polyfills']
}), new HtmlWebpackPlugin({
new HtmlWebpackPlugin({
template: './web/public/index.html',
chunksSortMode: 'dependency'
}),
new ExtractTextPlugin({filename: 'css/[name].[hash].css', disable: !isProd})
new MiniCssExtractPlugin({
filename: 'css/[name].[hash].css',
disable: !isProd
})
];
if (isProd) {
config.plugins.push(
new webpack.NoEmitOnErrorsPlugin(),
new webpack.optimize.UglifyJsPlugin({sourceMap: true, mangle: {keep_fnames: true}}),
new CopyWebpackPlugin([{
from: root('web/public')
}])