89 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| var path = require('path')
 | |
| var webpack = require('webpack')
 | |
| 
 | |
| module.exports = {
 | |
|   entry: './src/main.js',
 | |
|   output: {
 | |
|     path: path.resolve(__dirname, './dist'),
 | |
|     publicPath: '/dist/',
 | |
|     filename: 'build.js'
 | |
|   },
 | |
|   module: {
 | |
|     rules: [
 | |
|       {
 | |
|         test: /\.vue$/,
 | |
|         use: [
 | |
|           {
 | |
|             loader: 'vue-loader',
 | |
|             options: {
 | |
|               loaders: {
 | |
|                 'scss': 'vue-style-loader!css-loader!sass-loader',
 | |
|                 'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
 | |
|               }
 | |
|             }
 | |
|           },
 | |
|           {
 | |
|             loader: 'vue-svg-inline-loader'
 | |
|           }
 | |
|         ]
 | |
|       },
 | |
|       {
 | |
|         test: /\.js$/,
 | |
|         loader: 'babel-loader',
 | |
|         options: {
 | |
|           presets: ['@babel/preset-env']
 | |
|         },
 | |
|         exclude: /node_modules/
 | |
|       },
 | |
|       {
 | |
|         test: /\.(png|jpg|gif|svg)$/,
 | |
|         loader: 'file-loader',
 | |
|         options: {
 | |
|           name: '[name].[ext]'
 | |
|           // name: '[name].[ext]?[hash]'
 | |
|         }
 | |
|       }
 | |
|     ]
 | |
|   },
 | |
|   resolve: {
 | |
|     extensions: ['.js', '.vue', '.json', 'scss'],
 | |
|     alias: {
 | |
|       'vue$': 'vue/dist/vue.common.js',
 | |
|       '@': path.resolve(__dirname, './src'),
 | |
|       'src': path.resolve(__dirname, './src'),
 | |
|       'assets': path.resolve(__dirname, './src/assets'),
 | |
|       'components': path.resolve(__dirname, './src/components')
 | |
|     }
 | |
|   },
 | |
|   devServer: {
 | |
|     historyApiFallback: true,
 | |
|     inline: true,
 | |
|     noInfo: true
 | |
|   },
 | |
|   performance: {
 | |
|     hints: false
 | |
|   },
 | |
|   devtool: 'inline-source-map'
 | |
| }
 | |
| 
 | |
| if (process.env.NODE_ENV === 'production') {
 | |
|   module.exports.devtool = '#source-map'
 | |
|   // http://vue-loader.vuejs.org/en/workflow/production.html
 | |
|   module.exports.plugins = (module.exports.plugins || []).concat([
 | |
|     new webpack.DefinePlugin({
 | |
|       'process.env': {
 | |
|         NODE_ENV: '"production"'
 | |
|       }
 | |
|     }),
 | |
|     new webpack.optimize.UglifyJsPlugin({
 | |
|       sourceMap: true,
 | |
|       compress: {
 | |
|         warnings: false
 | |
|       }
 | |
|     }),
 | |
|     new webpack.LoaderOptionsPlugin({
 | |
|       minimize: true
 | |
|     })
 | |
|   ])
 | |
| }
 |