forked from cef62/ReactAngularWebpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.base.js
99 lines (87 loc) · 2.21 KB
/
webpack.config.base.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')
const rootFolder = process.cwd()
module.exports = {
devtool: 'source-map',
entry: './src/app/index.js',
output: {
filename: 'wws.bundle.js',
publicPath: '/',
path: path.resolve(rootFolder, 'dist'),
},
resolve: {
alias: {
'@resources': path.join(rootFolder, 'resources'),
},
extensions: ['.tsx', '.ts', '.js', '.css', '.html'],
plugins: [
// @ts-ignore
new TsconfigPathsPlugin({
configFile: path.join(rootFolder, 'tsconfig.json'),
}),
],
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
include: [
path.join(rootFolder, 'src', 'react'),
path.join(rootFolder, 'src', 'app', 'components', 'reactWrappers'),
],
loader: 'ts-loader',
options: {
transpileOnly: true,
onlyCompileBundledFiles: true,
projectReferences: true,
},
},
{
test: /\.(tpl)\.(html)$/,
use: 'html-loader',
},
{
test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.ttf(\?v=\d+\.\d+\.\d+)?$/i,
loader: 'file-loader',
include: [path.join(rootFolder, 'resources')],
options: {
name: '[path][name].[ext]?[hash]',
esModule: false,
},
},
],
},
plugins: [
new ForkTsCheckerWebpackPlugin({
// memoryLimit: 3072,
useTypescriptIncrementalApi: true,
// measureCompilationTime: true,
}),
new webpack.NamedModulesPlugin(),
new HtmlWebpackPlugin({
title: `AngularJS React POC`,
filename: 'index.html',
template: path.join('src', 'index.html'),
inject: true,
favicon: false,
hash: true,
cache: true,
minify: {
preserveLineBreaks: true,
removeComments: true,
},
chunksSortMode: 'auto',
unsupportedBrowser: true,
}),
],
optimization: {
runtimeChunk: false,
},
performance: {
hints: false,
},
}