1 | const path = require('path') |
||
2 | const webpack = require('webpack') |
||
3 | const HtmlWebpackPlugin = require('html-webpack-plugin'); |
||
4 | const ExtractTextPlugin = require("extract-text-webpack-plugin"); |
||
5 | const WebpackNotifierPlugin = require('webpack-notifier'); |
||
6 | const WebpackShellPlugin = require('webpack-shell-plugin'); |
||
7 | |||
8 | const isProduction = process.env.NODE_ENV === 'production' |
||
9 | |||
10 | const extractSass = new ExtractTextPlugin({ |
||
11 | filename: "css/app.[name].css", |
||
12 | disable: false |
||
13 | }); |
||
14 | |||
15 | |||
16 | const COMMON = { |
||
17 | module: { |
||
18 | rules: [ |
||
19 | { |
||
20 | test: /\.vue$/, |
||
21 | use: [{ |
||
22 | loader: 'vue-loader', |
||
23 | options: { |
||
24 | loaders: { |
||
25 | 'scss': 'vue-style-loader!css-loader!postcss-loader?sourceMap!sass-loader', |
||
26 | 'sass': 'vue-style-loader!css-loader!postcss-loader?sourceMap!sass-loader?indentedSyntax', |
||
27 | 'css': 'vue-style-loader!css-loader!postcss-loader?sourceMap' |
||
28 | }, |
||
29 | // other vue-loader options go here |
||
30 | postcss: [require('postcss-cssnext')()] |
||
31 | } |
||
32 | }] |
||
33 | }, |
||
34 | { |
||
35 | test: /\.js$/, |
||
36 | loader: 'babel-loader', |
||
37 | exclude: /node_modules/ |
||
38 | }, |
||
39 | { |
||
40 | test: /\.scss$/, |
||
41 | use: extractSass.extract({ |
||
42 | fallback: "style-loader", |
||
43 | use: [{ |
||
44 | loader: "css-loader", |
||
45 | options: {minimize: isProduction} |
||
46 | }, { |
||
47 | loader: "postcss-loader", |
||
48 | options: { |
||
49 | plugins: (loader) => [ |
||
0 ignored issues
–
show
|
|||
50 | require('autoprefixer')() |
||
51 | ] |
||
52 | } |
||
53 | }, { |
||
54 | loader: "sass-loader" |
||
55 | }] |
||
56 | }) |
||
57 | }, |
||
58 | { |
||
59 | test: /\.(png|jpg|gif|svg)$/, |
||
60 | loader: 'file-loader', |
||
61 | options: { |
||
62 | name: '[name].[ext]?[hash]' |
||
63 | } |
||
64 | } |
||
65 | ] |
||
66 | }, |
||
67 | plugins: [ |
||
68 | new WebpackNotifierPlugin({alwaysNotify: true}), |
||
69 | new WebpackShellPlugin({ |
||
70 | onBuildExit: ['node src\\docs\\js\\copy-to-docs.js'] |
||
71 | }) |
||
72 | ], |
||
73 | watchOptions: { |
||
74 | aggregateTimeout: 300, |
||
75 | ignored: /node_modules/ |
||
76 | }, |
||
77 | resolve: { |
||
78 | alias: { |
||
79 | 'vue$': 'vue/dist/vue.esm.js' |
||
80 | } |
||
81 | }, |
||
82 | devServer: { |
||
83 | historyApiFallback: true, |
||
84 | noInfo: true |
||
85 | }, |
||
86 | performance: { |
||
87 | hints: false |
||
88 | }, |
||
89 | devtool: '#eval-source-map' |
||
90 | } |
||
91 | |||
92 | const DOCS = Object.assign({}, COMMON, { |
||
93 | name: 'docs', |
||
94 | entry: [ |
||
95 | './src/docs/js/app.js', |
||
96 | './src/docs/scss/app.scss' |
||
97 | ], |
||
98 | output: { |
||
99 | path: path.resolve(__dirname, './docs'), |
||
100 | filename: "js/app.[name].js", |
||
101 | }, |
||
102 | devServer: { |
||
103 | contentBase: path.join(__dirname, "docs"), |
||
104 | compress: true, |
||
105 | port: 9000 |
||
106 | }, |
||
107 | externals: { |
||
108 | 'vue': 'Vue', |
||
109 | 'vuejs-dialog': 'VuejsDialog' |
||
110 | }, |
||
111 | plugins: [ |
||
112 | extractSass, |
||
113 | new HtmlWebpackPlugin({ |
||
114 | hash: true, |
||
115 | catch: true, |
||
116 | filename: 'index.html', |
||
117 | template: 'src/docs/index.html' |
||
118 | }) |
||
119 | ] |
||
120 | }) |
||
121 | |||
122 | const DIST = Object.assign({}, COMMON, { |
||
123 | name: 'dist', |
||
124 | entry: './src/plugin/js', |
||
125 | output: { |
||
126 | library: 'VuejsDialog', |
||
127 | libraryTarget: 'umd', |
||
128 | path: path.resolve(__dirname, './dist'), |
||
129 | publicPath: '/dist/', |
||
130 | filename: 'vuejs-dialog.min.js' |
||
131 | } |
||
132 | }) |
||
133 | |||
134 | if (isProduction) { |
||
135 | DIST.devtool = '#source-map' |
||
136 | // http://vue-loader.vuejs.org/en/workflow/production.html |
||
137 | DIST.plugins = (DIST.plugins || []).concat([ |
||
138 | new webpack.DefinePlugin({ |
||
139 | 'process.env': { |
||
140 | NODE_ENV: '"production"' |
||
141 | } |
||
142 | }), |
||
143 | new webpack.optimize.UglifyJsPlugin({ |
||
144 | sourceMap: true, |
||
145 | compress: { |
||
146 | warnings: false |
||
147 | } |
||
148 | }), |
||
149 | new webpack.LoaderOptionsPlugin({ |
||
150 | minimize: true |
||
151 | }) |
||
152 | ]) |
||
153 | |||
154 | DOCS.devtool = '#none' |
||
155 | DOCS.plugins = (DOCS.plugins || []).concat([ |
||
156 | new webpack.DefinePlugin({ |
||
157 | 'process.env': { |
||
158 | NODE_ENV: '"production"' |
||
159 | } |
||
160 | }), |
||
161 | new webpack.optimize.UglifyJsPlugin({ |
||
162 | sourceMap: false, |
||
163 | compress: { |
||
164 | warnings: false |
||
165 | } |
||
166 | }) |
||
167 | ]) |
||
168 | } |
||
169 | |||
170 | module.exports = [DOCS, DIST] |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.