-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
102 lines (96 loc) · 2.18 KB
/
webpack.dev.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
100
101
102
const webpack = require("webpack");
const helpers = require('./helpers');
//const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
require('dotenv').config();
const PRODUCTION = process.env.NODE_ENV === 'production';
console.log('PRODUCTION: ', PRODUCTION);
var plugins = [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.SENTRY_DSN': JSON.stringify(process.env.SENTRY_DSN)
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular|fesm5/,
helpers.root('./app'), {}
)
]
const styles = {
test: /\.(sc|c)ss$/,
use: [
{
loader: 'style-loader'
}, {
loader: 'css-loader',
options: {
sourceMap: true
}
}, {
loader: 'resolve-url-loader'
}, {
loader: 'sass-loader',
options: {
sourceMap: true
}
}]
};
module.exports = {
entry: {
main: './app/main.ts', // entry point for your application code
vendor: './app/vendor.ts'
},
output: {
filename: '[name].bundle.js',
publicPath: '/dist/',
libraryTarget: "amd"
},
resolve: {
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
chunks: 'all',
name: 'vendor',
test: 'vendor',
//enforce: true
}
}
}
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
'ts-loader',
'angular-router-loader'
]
},
{ test: /\.(woff|woff2|eot|ttf|svg)$/,
include: /node_modules/,
use: 'file-loader'
},
// css
styles
]
},
plugins: plugins,
externals: [
function(context, request, callback) {
if (/^dojo/.test(request) ||
/^dojox/.test(request) ||
/^dijit/.test(request) ||
/^esri/.test(request) ||
/^moment/.test(request)
) {
return callback(null, "amd " + request);
}
callback();
}
],
devtool: 'source-map'
};