-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
74 lines (73 loc) · 1.53 KB
/
webpack.common.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
const webpack = require('webpack');
const path = require('path');
module.exports = {
context: path.join(__dirname, 'src'),
output: {
path: path.resolve(__dirname, 'build', 'assets', 'scripts'),
filename: '[name].js',
publicPath: '/assets/scripts/',
},
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.js$/,
use: ['angular2-template-loader'],
exclude: [/node_modules/],
},
{
test: /\.css$/,
use: ['raw-loader'],
},
{
test: /\.html$/,
use: ['raw-loader'],
},
{
test: /\.pug$/,
use: [
'raw-loader',
{
loader: 'pug-html-loader',
query: { doctype: 'html', plugins: require('pug-plugin-ng') },
},
],
},
{
test: /\.scss$/,
use: [
'raw-loader',
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: loader => [
require('autoprefixer')('last 2 versions'),
require('cssnano')({ discardComments: { removeAll: true } }),
],
},
},
{
loader: 'sass-loader',
options: { includePaths: ['src/styles'] },
},
],
},
{
// Mark files inside `@angular/core` as using SystemJS style dynamic imports.
// Removing this will cause deprecation warnings to appear.
test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/,
parser: { system: true }, // enable SystemJS
},
],
},
plugins: [
new webpack.ContextReplacementPlugin(
/\@angular(\\|\/)core(\\|\/)fesm5/,
path.resolve(__dirname, 'src', 'ts'),
{}
),
],
};