|
| 1 | +const webpack = require('webpack'); |
| 2 | +const ExtractTextPlugin = require("extract-text-webpack-plugin"); |
| 3 | +const WebpackShellPlugin = require('webpack-shell-plugin'); |
| 4 | +const CopyWebpackPlugin = require('copy-webpack-plugin'); |
| 5 | + |
| 6 | +const config = { |
| 7 | + context: __dirname + '/src', |
| 8 | + entry: { |
| 9 | + 'background': './background.js', |
| 10 | + 'popup/popup': './popup/popup.js' |
| 11 | + }, |
| 12 | + output: { |
| 13 | + path: __dirname + '/dist', |
| 14 | + filename: '[name].js' |
| 15 | + }, |
| 16 | + resolve: { |
| 17 | + extensions: ['.js', '.vue'], |
| 18 | + }, |
| 19 | + // other options... |
| 20 | + module: { |
| 21 | + loaders: [ |
| 22 | + { |
| 23 | + test: /\.vue$/, |
| 24 | + loaders: 'vue-loader', |
| 25 | + options: { |
| 26 | + loaders: { |
| 27 | + scss: ExtractTextPlugin.extract({ |
| 28 | + use: 'css-loader!sass-loader', |
| 29 | + fallback: 'vue-style-loader' |
| 30 | + }), |
| 31 | + sass: ExtractTextPlugin.extract({ |
| 32 | + use: 'css-loader!sass-loader?indentedSyntax', |
| 33 | + fallback: 'vue-style-loader' |
| 34 | + }), |
| 35 | + } |
| 36 | + } |
| 37 | + }, |
| 38 | + { |
| 39 | + test: /\.js$/, |
| 40 | + loader: 'babel-loader', |
| 41 | + exclude: /node_modules/ |
| 42 | + }, |
| 43 | + { |
| 44 | + test: /\.css$/, |
| 45 | + use: ExtractTextPlugin.extract({ |
| 46 | + use: "css-loader", |
| 47 | + fallback: "vue-loader", |
| 48 | + }) |
| 49 | + }, |
| 50 | + { |
| 51 | + test: /\.(png|jpg|gif|svg|ico)$/, |
| 52 | + loader: 'file-loader', |
| 53 | + options: { |
| 54 | + name: '[name].[ext]?emitFile=false' |
| 55 | + } |
| 56 | + } |
| 57 | + ], |
| 58 | + }, |
| 59 | + plugins: [ |
| 60 | + new ExtractTextPlugin({ |
| 61 | + filename: '[name].css' |
| 62 | + }), |
| 63 | + new CopyWebpackPlugin([ |
| 64 | + {from: 'icons', to: 'icons'}, |
| 65 | + {from: 'popup/popup.html', to: 'popup/popup.html'}, |
| 66 | + {from: 'manifest.json', to: 'manifest.json'} |
| 67 | + ]), |
| 68 | + new WebpackShellPlugin({ |
| 69 | + onBuildEnd: ['bash scripts/remove-evals.sh'] |
| 70 | + }), |
| 71 | + ] |
| 72 | +}; |
| 73 | + |
| 74 | +module.exports = config; |
0 commit comments