File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 "main" : " dist/APlayer.min.js" ,
66 "scripts" : {
77 "test" : " webpack" ,
8- "start" : " webpack-dev-server --hot --progress --inline --host 0.0.0.0"
8+ "build" : " webpack" ,
9+ "dev" : " WEBPACK_ENV=dev webpack-dev-server --hot --progress --inline --host 0.0.0.0"
910 },
1011 "repository" : {
1112 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -2,23 +2,37 @@ var webpack = require('webpack');
22var path = require ( 'path' ) ;
33var autoprefixer = require ( 'autoprefixer' ) ;
44
5+ var libraryName = 'APlayer' ;
6+ var env = process . env . WEBPACK_ENV ;
57var ROOT_PATH = path . resolve ( __dirname ) ;
68var APP_PATH = path . resolve ( ROOT_PATH , 'src' ) ;
79var BUILD_PATH = path . resolve ( ROOT_PATH , 'dist' ) ;
810
9- module . exports = {
10- devtool : 'source-map' ,
11+ var plugins = [ ] ;
12+ if ( env !== 'dev' ) {
13+ plugins . push (
14+ new webpack . optimize . UglifyJsPlugin ( {
15+ compress : {
16+ warnings : false
17+ } ,
18+ minimize : true
19+ } )
20+ ) ;
21+ }
1122
12- entry : './src/APlayer.js' ,
23+ module . exports = {
24+ entry : './src/' + libraryName + '.js' ,
1325
1426 output : {
1527 path : BUILD_PATH ,
16- filename : 'APlayer .min.js',
17- library : 'APlayer' ,
28+ filename : libraryName + ' .min.js',
29+ library : libraryName ,
1830 libraryTarget : 'umd' ,
1931 umdNamedDefine : true
2032 } ,
2133
34+ devtool : 'source-map' ,
35+
2236 devServer : {
2337 publicPath : "/dist/" ,
2438 } ,
@@ -45,13 +59,7 @@ module.exports = {
4559 ]
4660 } ,
4761
48- plugins : [
49- new webpack . optimize . UglifyJsPlugin ( {
50- compress : {
51- warnings : false
52- }
53- } )
54- ] ,
62+ plugins : plugins ,
5563
5664 postcss : [
5765 autoprefixer ( {
You can’t perform that action at this time.
0 commit comments