You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 lines
2.3 KiB

  1. var webpack = require('webpack');
  2. var path = require('path');
  3. var ExtractTextPlugin = require('extract-text-webpack-plugin');
  4. module.exports = {
  5. entry: './src/main.js',
  6. output: {
  7. path: path.resolve(__dirname, './dist'),
  8. publicPath: '/dist/',
  9. filename: 'lesspass.js'
  10. },
  11. resolve: {
  12. extensions: ['.json', '.js', '.vue'],
  13. alias: {
  14. jquery: 'jquery/src/jquery'
  15. }
  16. },
  17. module: {
  18. rules: [
  19. {test: /\.vue$/, loader: 'vue-loader'},
  20. {test: /\.js$/, include: [path.resolve(__dirname, './src')], loader: 'babel-loader'},
  21. {test: /\.json/, loader: 'json-loader'},
  22. {test: /\.(png|jpg|jpeg|gif)$/, loader: 'file-loader?name=[name].[ext]',},
  23. {
  24. test: /\.css$/,
  25. loader: ExtractTextPlugin.extract({
  26. fallbackLoader: 'style-loader',
  27. loader: 'css-loader',
  28. publicPath: ''
  29. })
  30. },
  31. {test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  32. {test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  33. {test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/octet-stream'},
  34. {test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'},
  35. {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=image/svg+xml'},
  36. ]
  37. },
  38. plugins: [
  39. new ExtractTextPlugin('lesspass.css'),
  40. new webpack.ProvidePlugin({
  41. $: 'jquery',
  42. jQuery: 'jquery',
  43. 'window.jQuery': 'jquery',
  44. 'window.Tether': 'tether'
  45. })
  46. ],
  47. devtool: '#eval-source-map'
  48. };
  49. if (process.env.NODE_ENV === 'production') {
  50. module.exports.devtool = false;
  51. module.exports.plugins = (module.exports.plugins || []).concat([
  52. new webpack.optimize.DedupePlugin(),
  53. new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
  54. new webpack.optimize.UglifyJsPlugin({
  55. compress: {
  56. warnings: true
  57. },
  58. output: {
  59. comments: false
  60. },
  61. sourceMap: false
  62. })
  63. ]);
  64. }