|  | /* | 
|  | * Copyright 2017, The Android Open Source Project | 
|  | * | 
|  | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | * you may not use this file except in compliance with the License. | 
|  | * You may obtain a copy of the License at | 
|  | * | 
|  | *     http://www.apache.org/licenses/LICENSE-2.0 | 
|  | * | 
|  | * Unless required by applicable law or agreed to in writing, software | 
|  | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | * See the License for the specific language governing permissions and | 
|  | * limitations under the License. | 
|  | */ | 
|  |  | 
|  | const fs = require('fs'); | 
|  | var path = require('path') | 
|  | var webpack = require('webpack') | 
|  | var HtmlWebpackPlugin = require('html-webpack-plugin') | 
|  | var HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin') | 
|  |  | 
|  | function getWaylandSafePath() { | 
|  | waylandPath = path.resolve(__dirname, '../../../vendor/google_arc/libs/wayland_service'); | 
|  | if (fs.existsSync(waylandPath)) { | 
|  | return waylandPath; | 
|  | } | 
|  | return path.resolve(__dirname, 'src/stubs'); | 
|  | } | 
|  |  | 
|  | module.exports = { | 
|  | entry: ["@babel/polyfill", './src/main.js'], | 
|  | output: { | 
|  | path: path.resolve(__dirname, './dist'), | 
|  | filename: 'build.js' | 
|  | }, | 
|  | module: { | 
|  | rules: [ | 
|  | { | 
|  | test: /\.vue$/, | 
|  | loader: 'vue-loader', | 
|  | options: { | 
|  | loaders: { | 
|  | } | 
|  | // other vue-loader options go here | 
|  | } | 
|  | }, | 
|  | { | 
|  | test: /\.js$/, | 
|  | loader: 'babel-loader', | 
|  | exclude: /node_modules/ | 
|  | }, | 
|  | { | 
|  | test: /\.proto$/, | 
|  | loader: 'proto-loader', | 
|  | options: { | 
|  | paths: [ | 
|  | path.resolve(__dirname, '../../..'), | 
|  | path.resolve(__dirname, '../../../external/protobuf/src') | 
|  | ] | 
|  | } | 
|  | }, | 
|  | { | 
|  | test: /\.(png|jpg|gif|svg)$/, | 
|  | loader: 'file-loader', | 
|  | options: { | 
|  | name: '[name].[ext]?[hash]' | 
|  | } | 
|  | } | 
|  | ] | 
|  | }, | 
|  | resolve: { | 
|  | alias: { | 
|  | WaylandSafePath: getWaylandSafePath(), | 
|  | }, | 
|  | modules: [ | 
|  | 'node_modules', | 
|  | path.resolve(__dirname, '../../..') | 
|  | ], | 
|  | }, | 
|  | resolveLoader: { | 
|  | modules: [ | 
|  | 'node_modules', | 
|  | path.resolve(__dirname, 'loaders') | 
|  | ] | 
|  | }, | 
|  | devServer: { | 
|  | historyApiFallback: true, | 
|  | noInfo: true | 
|  | }, | 
|  | performance: { | 
|  | hints: false | 
|  | }, | 
|  | devtool: '#eval-source-map' | 
|  | } | 
|  |  | 
|  | var prod = (process.env.NODE_ENV === 'production'); | 
|  |  | 
|  | if (prod) { | 
|  | 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 | 
|  | }) | 
|  | ]) | 
|  | } | 
|  |  | 
|  | module.exports.plugins = (module.exports.plugins || []).concat([ | 
|  | new HtmlWebpackPlugin({ | 
|  | inlineSource: prod ? '.(js|css)' : false, | 
|  | template: 'src/index_template.html' | 
|  | }), | 
|  | new HtmlWebpackInlineSourcePlugin(), | 
|  | ]); |