webpack.extension.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. const path = require('path');
  2. const CopyWebpackPlugin = require('copy-webpack-plugin');
  3. const demoConfig = require('./webpack.demo');
  4. const webpack = require('webpack');
  5. const ProgressBarPlugin = require('progress-bar-webpack-plugin');
  6. const VueLoaderPlugin = require('vue-loader/lib/plugin');
  7. demoConfig.entry = {
  8. background: path.join(process.cwd(), './examples/extension/src/background'),
  9. entry: path.join(process.cwd(), './examples/extension/src/entry')
  10. };
  11. demoConfig.output = {
  12. path: path.join(process.cwd(), './examples/extension/dist'),
  13. filename: '[name].js'
  14. };
  15. demoConfig.plugins = [
  16. new CopyWebpackPlugin([
  17. { from: 'examples/extension/src/manifest.json' },
  18. { from: 'examples/extension/src/icon.png' }
  19. ]),
  20. new VueLoaderPlugin(),
  21. new ProgressBarPlugin(),
  22. new webpack.LoaderOptionsPlugin({
  23. vue: {
  24. compilerOptions: {
  25. preserveWhitespace: false
  26. }
  27. }
  28. }),
  29. new webpack.HotModuleReplacementPlugin()
  30. ];
  31. demoConfig.module.rules.find(a => a.loader === 'url-loader').query = {};
  32. module.exports = demoConfig;