您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

67 行
2.4 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: ['', '.js', '.vue'],
  13. fallback: [path.join(__dirname, 'node_modules')],
  14. alias: {
  15. src: path.resolve(__dirname, './src'),
  16. jquery: 'jquery/src/jquery'
  17. }
  18. },
  19. resolveLoader: {
  20. root: path.join(__dirname, 'node_modules')
  21. },
  22. module: {
  23. loaders: [
  24. {test: /\.vue$/, loader: 'vue-loader'},
  25. {test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'},
  26. {test: /\.json/, loader: 'json-loader'},
  27. {test: /\.(png|jpg|jpeg|gif)$/, loader: 'file-loader?name=[name].[ext]',},
  28. {test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader', {publicPath: ''})},
  29. {test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  30. {test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  31. {test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/octet-stream'},
  32. {test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'},
  33. {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=image/svg+xml'},
  34. ]
  35. },
  36. plugins: [
  37. new ExtractTextPlugin('lesspass.css'),
  38. new webpack.ProvidePlugin({
  39. $: 'jquery',
  40. jQuery: 'jquery',
  41. 'window.jQuery': 'jquery',
  42. 'window.Tether': 'tether'
  43. })
  44. ],
  45. devtool: '#eval-source-map'
  46. };
  47. if (process.env.NODE_ENV === 'production') {
  48. module.exports.devtool = false;
  49. module.exports.plugins = (module.exports.plugins || []).concat([
  50. new webpack.optimize.DedupePlugin(),
  51. new webpack.optimize.OccurrenceOrderPlugin(),
  52. new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
  53. new webpack.optimize.UglifyJsPlugin({
  54. compress: {
  55. warnings: true
  56. },
  57. output: {
  58. comments: false
  59. },
  60. sourceMap: false
  61. })
  62. ]);
  63. }