This repository was archived by the owner on Mar 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
127 lines (112 loc) · 2.69 KB
/
webpack.config.js
File metadata and controls
127 lines (112 loc) · 2.69 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const { resolve } = require('path');
const rxPaths = require('rxjs/_esm5/path-mapping');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const { AngularCompilerPlugin } = require('@ngtools/webpack');
const { IndexHtmlWebpackPlugin } = require('@angular-devkit/build-angular/src/angular-cli-files/plugins/index-html-webpack-plugin');
module.exports = {
mode: 'development',
devtool: 'eval',
entry: {
main: './src/main.ts',
polyfills: './src/polyfills.ts',
styles: './src/styles.scss'
},
output: {
path: resolve('./dist'),
filename: '[name].js',
},
resolve: {
extensions: ['.ts', '.js'],
alias: rxPaths()
},
node: false,
performance: {
hints: false,
},
module: {
rules: [
{
test: /\.ts$/,
use: '@ngtools/webpack'
},
{
test: /\.js$/,
exclude: /(ngfactory|ngstyle).js$/,
enforce: 'pre',
use: 'source-map-loader'
},
{
test: /\.html$/,
use: 'raw-loader'
},
{
test: /\.css$/,
use: ['to-string-loader', 'css-loader'],
exclude: [resolve('./src/styles.css')]
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
include: [resolve('./src/styles.css')]
},
{
test: /\.scss$/,
loader: ["raw-loader", "sass-loader?sourceMap"]
},
{
test: /\.(eot|svg|cur)$/,
loader: 'file-loader',
options: {
name: `[name].[ext]`,
limit: 10000
}
},
{
test: /\.(jpg|png|webp|gif|otf|ttf|woff|woff2|ani)$/,
loader: 'url-loader',
options: {
name: `[name].[ext]`,
limit: 10000
}
},
// This hides some deprecation warnings that Webpack throws
{
test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/,
parser: { system: true },
}
]
},
plugins: [
new IndexHtmlWebpackPlugin({
input: './index.html',
output: 'index.html',
entrypoints: [
'styles',
'polyfills',
'main'
]
}),
new AngularCompilerPlugin({
mainPath: resolve('./src/main.ts'),
sourceMap: true,
nameLazyFiles: true,
tsConfigPath: resolve('./src/tsconfig.app.json'),
skipCodeGeneration: true
}),
new ProgressPlugin(),
new CircularDependencyPlugin({
exclude: /[\\\/]node_modules[\\\/]/
}),
new CopyWebpackPlugin([
{
from: 'src/assets',
to: 'assets'
},
{
from: 'src/favicon.ico'
}
])
]
};