-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
105 lines (95 loc) · 2.36 KB
/
Copy pathwebpack.config.js
File metadata and controls
105 lines (95 loc) · 2.36 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
const webpack = require('webpack')
const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { CheckerPlugin } = require('awesome-typescript-loader')
// Webpack Config
const webpackConfig = {
entry: {
'main': './src/main.ts',
'vendor': ['jquery', 'bootstrap', 'rxjs']
},
output: {
filename: '[name].js',
path: path.join(__dirname, 'dist'),
publicPath: '/'
},
plugins: [
new CheckerPlugin(),
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.js' }),
new ExtractTextPlugin('style.css'),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.html',
inject: true
}),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery'
})
],
module: {
loaders: [
{
test: /\.ts?$/,
exclude: /node_modules/,
loader: 'tslint-loader',
enforce: 'pre',
},
{
test: /\.js$/,
loader: 'source-map-loader',
include: /rxjs/,
enforce: 'pre',
},
{
test: /\.ts$/,
use: 'awesome-typescript-loader'
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
})
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
use: 'file-loader'
},
{
test: /\.html$/,
use: 'raw-loader'
}
]
}
}
// Our Webpack Defaults
const defaultConfig = {
devtool: 'cheap-module-source-map',
cache: true,
resolve: {
modules: [ path.join(__dirname, 'src'), 'node_modules' ],
extensions: ['.ts', '.js'],
alias: {
'bootstrap': path.join(process.cwd(), 'node_modules/bootstrap/dist/js/npm.js'),
'bootstrap.min.css': path.join(process.cwd(), 'node_modules/bootstrap/dist/css/bootstrap.min.css')
}
},
devServer: {
historyApiFallback: true,
watchOptions: { aggregateTimeout: 300, poll: 1000 }
},
node: {
global: true,
crypto: false,
module: false,
Buffer: false,
clearImmediate: false,
setImmediate: false
}
}
const webpackMerge = require('webpack-merge')
module.exports = webpackMerge(defaultConfig, webpackConfig)