This repository has been archived by the owner on May 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
125 lines (114 loc) · 3.03 KB
/
webpack.config.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
var path = require("path");
// var webpack = require("webpack");
const merge = require('webpack-merge');
var prodConfig = {
optimization: {
minimize: true,
},
};
module.exports = function(env) {
return merge({
context: path.resolve(__dirname),
mode: "development",
entry: {
'isaac.js': ["./app/js/app/app.js"],
},
output: {
path: path.resolve(__dirname, "app"),
filename: '[name]',
},
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/, /^app\/js\/lib\/((!?graph_sketcher).)*$/],
use: 'babel-loader?cacheDirectory=true',
},
{
test: /\.html$/,
use: [
{ loader: 'ngtemplate-loader', options: { relativeTo: "/partials", prefix: "/partials", module: "isaac.templates" } },
{ loader: 'html-loader' }
]
},
{
test: /(?!\.d)\.ts$/,
use: [
{ loader: "babel-loader" },
{ loader: "ts-loader", options: { ignoreDiagnostics: [2306] } }
]
},
{
test: /\.ne$/,
use: [
{ loader: "babel-loader" },
{ loader: "nearley-es6-loader" }
]
},
{
test: path.resolve(__dirname, "node_modules", "jquery", "dist", "jquery.js"),
use: [
{loader:"expose-loader", options: "jQuery"},
{loader:"expose-loader", options: "$"}
]
},
{
test: /modernizr/,
use: [
{loader:"imports-loader?this=>window"},
]
},
{
test: /opentip-jquery/,
use: [
{loader:"expose-loader", options: "Opentip"},
]
},
{
test: /showdown\.js/,
use: [
{loader:"expose-loader", options: "Showdown"},
]
},
{
test: /angular-ui-router\.js/,
use: "imports-loader?angular",
},
{
test: /angular-google-maps\.js/,
use: "imports-loader?_=lodash",
},
{
test: /script\/.*\.js$/,
use: [{loader: 'script-loader'}]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
{
loader: 'file-loader',
options: {
outputPath: 'assets/font',
},
}
]
}
]
},
resolve: {
modules: [path.resolve(__dirname), "node_modules"],
extensions: ['.js', '.html', '.ts'],
alias: {
'jquery-ui/datepicker' : 'jquery-ui/ui/widgets/datepicker',
'/partials': 'app/partials',
'showdown': 'app/js/lib/showdown/showdown.js',
'p5': 'node_modules/p5/lib/p5.min.js' // p5 otherwise defaults to non-minified!
},
},
resolveLoader: {
modules: ["node_modules", path.resolve(__dirname, "app/js/lib/webpack-loaders")]
},
// Generate source maps
devtool: "source-map",
}, env == "prod" ? prodConfig : {} );
};