@@ -5,15 +5,18 @@ const path = require('path');
5
5
const webpack = require ( 'webpack' ) ;
6
6
const CleanWebpackPlugin = require ( 'clean-webpack-plugin' ) ;
7
7
const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
8
+ const CopyWebpackPlugin = require ( 'copy-webpack-plugin' ) ;
8
9
9
10
const DIR = {
10
11
src : path . join ( __dirname , 'src' ) ,
11
- dist : path . join ( __dirname , 'dist ' )
12
+ dist : path . join ( __dirname , 'dist1 ' )
12
13
} ;
13
14
14
15
module . exports = {
15
16
16
- entry : DIR . src + '/app' ,
17
+ entry : {
18
+ 'main' : DIR . src + '/app'
19
+ } ,
17
20
18
21
output : {
19
22
path : DIR . dist ,
@@ -22,11 +25,11 @@ module.exports = {
22
25
} ,
23
26
24
27
resolve : {
25
- modulesDirectories : [ 'node_modules' , 'bower_components' ] ,
28
+ modulesDirectories : [ 'node_modules' ] ,
26
29
alias : {
27
- compat : path . join ( DIR . src , 'compat' ) ,
28
- components : path . join ( DIR . src , 'components' ) ,
29
- services : path . join ( DIR . src , 'services' )
30
+ // compat: path.join(DIR.src, 'compat'),
31
+ // components: path.join(DIR.src, 'components'),
32
+ // services: path.join(DIR.src, 'services')
30
33
}
31
34
} ,
32
35
@@ -37,28 +40,30 @@ module.exports = {
37
40
} ) ,
38
41
39
42
new HtmlWebpackPlugin ( {
40
- template : 'src/index.html'
43
+ template : 'src/index.html' ,
44
+ inject : 'body'
41
45
} ) ,
42
46
43
47
new webpack . HotModuleReplacementPlugin ( ) ,
44
-
45
- new webpack . ResolverPlugin ( [
46
- new webpack . ResolverPlugin . DirectoryDescriptionFilePlugin ( 'bower.json' , [ 'main' ] )
47
- ] ) ,
48
-
49
48
new webpack . optimize . CommonsChunkPlugin ( {
50
49
name : 'main' ,
51
50
async : true
52
- } )
51
+ } ) ,
52
+
53
+ new CopyWebpackPlugin ( [
54
+ { from : DIR . src + '/images' , to : 'images' } ,
55
+ { from : DIR . src + '/main.js' } ,
56
+ { from : DIR . src + '/package.json' }
57
+ ] )
53
58
] ,
54
59
55
60
module : {
56
61
preLoaders : [
57
- {
58
- // test: /\.js$/,
59
- // loader: 'eslint',
60
- // exclude: /node_modules|bower_components/
61
- }
62
+ // {
63
+ // test: /\.js$/,
64
+ // loader: 'eslint',
65
+ // exclude: /node_modules|bower_components/
66
+ // }
62
67
] ,
63
68
loaders : [
64
69
{
@@ -67,19 +72,30 @@ module.exports = {
67
72
} ,
68
73
{
69
74
test : / \. j s $ / ,
70
- loader : 'babel' ,
75
+ loader : 'ng-annotate! babel' ,
71
76
exclude : / n o d e _ m o d u l e s | b o w e r _ c o m p o n e n t s /
72
77
} ,
73
78
{
74
79
test : / \. h t m l $ / ,
75
80
loader : 'html'
76
81
} ,
82
+ {
83
+ test : / \. l e s s $ / ,
84
+ loader : "style!css!less"
85
+ } ,
77
86
{
78
87
test : / \. c s s $ / ,
79
88
loader : 'style!css'
80
89
} ,
81
90
{
82
- test : / ( \. e o t | \. t t f | \. w o f f 2 ? | \. s v g ) $ / ,
91
+ test : / \. s v g $ / ,
92
+ loader : 'svg-sprite?' + JSON . stringify ( {
93
+ name : '[name]' ,
94
+ angularBaseWorkaround : true
95
+ } )
96
+ } ,
97
+ {
98
+ test : / ( \. e o t | \. t t f | \. w o f f 2 ? ) $ / ,
83
99
loader : 'url'
84
100
}
85
101
]
0 commit comments