-
Notifications
You must be signed in to change notification settings - Fork 50
/
webpack.config.js
117 lines (104 loc) · 2.9 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
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");
const path = require('path');
const helpers = require('./helpers');
var babelPresets = ["es2015"];
var oldPath = path.resolve(__dirname, './src/views');
var newPath = path.resolve(__dirname, './src/app');
const METADATA = {
title: 'OrientDB Studio',
baseUrl: '/',
isDevServer: true
};
module.exports = function (options) {
var isProd = false;
return {
entry: {
'main': ['babel-polyfill','./src/main.browser.ts']
},
resolve: {
/*
* An array of extensions that should be used to resolve modules.
*
* See: http://webpack.github.io/docs/configuration.html#resolve-extensions
*/
extensions: ['.ts', '.js', '.json'],
// An array of directory names to be resolved to the current directory
},
output: {
path: path.join(__dirname, 'dist/www'),
filename: "[name].js"
},
plugins: [
new webpack.DefinePlugin({"global.GENTLY": false}),
new HtmlWebpackPlugin({
template: "src/index.html",
title: METADATA.title,
chunksSortMode: 'none',
metadata: METADATA,
inject: 'head'
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
c3: "c3",
"window.jQuery": "jquery",
_: "underscore",
S: "string",
moment: "moment",
"window.CodeMirror": "codemirror",
CodeMirror: "codemirror"
})
],
module: {
loaders: [
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader', '@angularclass/hmr-loader'],
exclude: [/\.(spec|e2e)\.ts$/, /node_modules\/(?!(ng2-.+))/]
},
{
test: /\.js[x]?$/,
exclude: /(node_modules|src\/vendor)/,
loaders: ["babel-loader?" + babelPresets.map((preset) => `presets[]=${preset}`).join("&")]
},
{
test: /\.css$/,
loader: "style-loader!css-loader"
// loader: "raw-loader!css-loader"
},
{
test: /\.(eot|svg|ttf|woff(2)?)(\?v=\d+\.\d+\.\d+)?/,
loader: 'url-loader'
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.(jpg|svg|gif|png)$/,
loader: "file-loader"
},
{
test: /\.html$/,
loader: 'html-loader',
exclude: [/src\/views/]
},
{
test: /\.html$/,
loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, './src')) + '/!html-loader',
exclude: [/src\/app/, /src\/components/,path.resolve(__dirname, 'src/index.html')]
},
]
},
devtool: "source-map",
devServer: {
proxy: {
'/api/*': {
target: 'http://localhost:2480',
pathRewrite: {"^/api": ""}
}
}
}
}
};