This repository has been archived by the owner on Dec 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.ts
72 lines (67 loc) · 1.98 KB
/
webpack.config.ts
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
/// <reference path="typings/index.d.ts" />
var fs = require('fs');
var webpack = require('webpack');
var path = require('path');
var CopyFilesPlugin = require('copy-webpack-plugin');
var UglifyJsPlugin = require('webpack-uglify-js-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
devtool: 'source-map',
entry: {
main: path.resolve(__dirname, 'src/js/main.ts')
},
output: {
path: path.resolve(__dirname, 'dist/js'),
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
},
{
test: /\.ts$/,
exclude: /node_modules/,
loader: 'ts-loader'
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
}
]
},
resolve: {
extensions: ['', '.js', '.es6', 'json', 'ts', 'less']
},
plugins: [
new CopyFilesPlugin([
{ from: 'src/manifest.json', to: path.resolve(__dirname, 'dist/manifest.json') },
{ from: 'src/_locales', to: path.resolve(__dirname, 'dist/_locales') },
{ from: 'src/img', to: path.resolve(__dirname, 'dist/img') },
], {
ignore: [
'.*',
],
copyUnmodified: true,
debug: 'warning'
}),
new UglifyJsPlugin({
cacheFolder: path.resolve(__dirname, 'public/chached_uglify'),
debug: true,
minimize: false,
sourceMap: true,
output: {
comments: false
},
compressor: {
warnings: false
}
}),
new ExtractTextPlugin('[name].css')
]
}