merged old webpack.config from admin and removed test targets, fuck tests

This commit is contained in:
Daniel Hübleitner
2019-07-28 12:45:59 +02:00
parent f7422ed7f8
commit 1926e255c3
+96 -119
View File
@@ -1,4 +1,5 @@
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const webpack = require('webpack'); const webpack = require('webpack');
const path = require('path'); const path = require('path');
const ROOT_PATH = path.resolve(__dirname); const ROOT_PATH = path.resolve(__dirname);
@@ -8,130 +9,106 @@ const NODE_MODULES_PATH = path.resolve(ROOT_PATH, 'node_modules');
const ENTRY_FILE = path.resolve(APP_PATH, 'index'); const ENTRY_FILE = path.resolve(APP_PATH, 'index');
const TEMPLATE_FILE = path.resolve(APP_PATH, 'index.html'); //html const TEMPLATE_FILE = path.resolve(APP_PATH, 'index.html'); //html
module.exports = { module.exports = [
mode: 'development', {
devtool: 'source-map', mode: 'development',
entry: { devtool: 'source-map',
app: ENTRY_FILE, entry: {
vendor: [ app: ENTRY_FILE,
"angular", vendor: [
'@uirouter/angularjs' "angular",
] '@uirouter/angularjs'
}, ]
output: { },
path: BUILD_PATH, output: {
filename: 'js/[name].[hash:8].js', path: BUILD_PATH,
chunkFilename: '[name].[chunkhash:8].js', filename: 'js/[name].[hash:8].js',
publicPath: '/' chunkFilename: '[name].[chunkhash:8].js',
}, publicPath: '/'
module: { },
rules: [ devServer: {
{ hot: true,
test: /\.html$/, contentBase: BUILD_PATH,
use: { port: 3000,
loader: 'html-loader', publicPath: '/'
options: { },
exportAsEs6Default: true, plugins: [
minimize: true, new HtmlWebpackPlugin({
removeComments: true filename: path.resolve(BUILD_PATH, 'index.html'),
template: TEMPLATE_FILE,
hash: false,
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin()
],
optimization: {
splitChunks: {
cacheGroups: {
common: {
chunks: 'all',
minChunks: 2,
maxInitialRequests: 5,
minSize: 0,
name: 'common'
},
vendor: {
test: /node_modules/,
chunks: 'all',
name: 'vendor',
priority: 10,
enforce: true,
minChunks: 2
} }
} }
}, }
{ },
test: /\.css$/, resolve: {
exclude: NODE_MODULES_PATH, extensions: ['.js', '.ts', '.less', '.scss', '.css'],
use: ['style-loader', 'css-loader', 'postcss-loader'], alias: {
include: APP_PATH '@': APP_PATH,
}, }
{ }
test: /\.less$/, },
use: ['style-loader', 'css-loader', 'postcss-loader', 'less-loader'], {
}, mode: 'development',
{ entry: path.resolve(__dirname, 'lib/FrontblockLib.js'),
test: /\.scss$/, output: {
exclude: NODE_MODULES_PATH, path: path.resolve(__dirname, 'static'),
use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'], filename: 'FrontblockLib.js',
include: APP_PATH },
}, module: {
{ rules: [
test: /\.(eot|woff|ttf|woff2)(\?|$)/, { test: /\FrontblockLib.ts/, use: 'ts-loader' }
exclude: NODE_MODULES_PATH, ]
use: { },
loader: 'file-loader', optimization: {
options: { minimizer: [new TerserPlugin({
name: '[name].[ext]' cache: true,
parallel: true,
terserOptions:{
mangle: false,
keep_classnames: true
} }
}, })],
include: APP_PATH splitChunks: {
}, cacheGroups: {
{ common: {
test: /\.(png|jpg|gif|svg)$/, chunks: 'all',
exclude: NODE_MODULES_PATH, minChunks: 2,
use: { maxInitialRequests: 5,
loader: 'url-loader', minSize: 0,
options: { name: 'common'
limit: 8192, },
name: 'images/[name].[hash:8].[ext]' vendor: {
} test: /node_modules/,
}, chunks: 'all',
include: APP_PATH name: 'vendor',
}, priority: 10,
{ enforce: true,
test: /\.ts$/, minChunks: 2
exclude: NODE_MODULES_PATH,
use: [
'ts-loader',
{
loader: 'tslint-loader',
options: {
configFile: ROOT_PATH + '/tslint.json'
} }
} }
],
include: APP_PATH
}
]
},
devServer: {
hot: true,
contentBase: BUILD_PATH,
port: 3000,
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin({
filename: path.resolve(BUILD_PATH, 'index.html'),
template: TEMPLATE_FILE,
hash: false,
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin()
],
optimization: {
splitChunks: {
cacheGroups: {
common: {
chunks: 'all',
minChunks: 2,
maxInitialRequests: 5,
minSize: 0,
name: 'common'
},
vendor: {
test: /node_modules/,
chunks: 'all',
name: 'vendor',
priority: 10,
enforce: true,
minChunks: 2
} }
} }
}
},
resolve: {
extensions: ['.js', '.ts', '.less', '.scss', '.css'],
alias: {
'@': APP_PATH,
}
} }
} ];