1 const path = require('path')
2 const execa = require('execa')
3 const webpack = require('webpack')
4 const CopyWebpackPlugin = require('copy-webpack-plugin')
5 const WebpackAutoInject = require('webpack-auto-inject-version')
6 const ChromeReloadPlugin = require('wcer')
7 const { resolve, page, assetsPath } = require('./util')
9 var gitHash = execa.sync('git', ['rev-parse', '--short', 'HEAD']).stdout
10 console.log('gitHash:', gitHash)
13 popup: resolve('src/popup.js'),
14 prompt: resolve('src/prompt.js'),
15 content: resolve('src/content.js'),
16 inject: resolve('src/inject.js'),
17 background: resolve('src/background.js')
20 path: resolve('dist'),
22 filename: 'js/[name].js',
23 chunkFilename: 'js/[name].js'
29 use: ['vue-style-loader', 'css-loader']
33 use: ['vue-style-loader', 'css-loader', 'sass-loader']
37 use: ['vue-style-loader', 'css-loader', 'sass-loader?indentedSyntax']
44 // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
45 // the "scss" and "sass" values for the lang attribute to the right configs here.
46 // other preprocessors should work out of the box, no loader config like this necessary.
47 scss: ['vue-style-loader', 'css-loader', 'sass-loader'],
51 'sass-loader?indentedSyntax'
54 // other vue-loader options go here
59 loader: 'babel-loader',
60 exclude: /node_modules/
63 test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
67 name: assetsPath('img/[name].[hash:7].[ext]')
71 test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
75 name: assetsPath('media/[name].[hash:7].[ext]')
79 test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
83 name: assetsPath('fonts/[name].[hash:7].[ext]')
90 vue$: 'vue/dist/vue.esm.js',
91 '@': path.resolve('src')
93 extensions: ['*', '.js', '.vue', '.json']
102 title: 'options title',
107 title: 'Byone notification',
111 new CopyWebpackPlugin([
113 from: resolve('static')
116 new ChromeReloadPlugin({
118 manifest: resolve('src/manifest.js')
120 new webpack.DefinePlugin({
121 'version.hash': JSON.stringify(gitHash)
123 new WebpackAutoInject({
124 PACKAGE_JSON_PATH: './package.json',
126 AutoIncreaseVersion: false