forked from mabels/posco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
60 lines (58 loc) · 1.37 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
const fs = require('fs');
const node_modules = fs.readdirSync('node_modules').filter(x => x !== '.bin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const globby = require('globby');
fs.writeFileSync('test/all.ts',
globby.sync(['test/**/*-test.ts', 'test/**/*-test.tsx'])
.map(file => file.replace('test/', '').replace(/\.tsx?$/, ''))
.map(file => `import './${file}';`)
.join('\n'));
module.exports = [
{
target: 'node',
entry: './src/main',
output: {
path: __dirname + '/dist',
filename: 'main.js',
libraryTarget: 'commonjs2'
},
module: {
loaders: [
{
test: /\.tsx?$/,
loader: 'awesome-typescript?useBabel=true'
}
]
},
externals: node_modules,
devtool: 'source-map',
resolve: {
extensions: ['', '.ts', '.webpack.js', '.web.js', '.js']
}
},{
target: 'node',
entry: './test/all',
output: {
path: __dirname + '/dist',
filename: 'test.js',
libraryTarget: 'commonjs2'
},
module: {
loaders: [
{
test: /\.tsx?$/,
loader: 'awesome-typescript?useBabel=true'
},
{
test: /\.less$/,
loader: 'style!css!less'
}
]
},
externals: node_modules,
devtool: 'source-map',
resolve: {
extensions: ['', '.tsx', '.ts', '.webpack.js', '.web.js', '.js']
}
}];