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.
 
 
 
 
 
 

62 lines
1.8 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: 'bundle.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: /\.(png|jpg|jpeg|gif)$/, loader: 'url?limit=10000&name=images/[name].[ext]',},
  27. {test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader')},
  28. {test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/, loader: 'file-loader'}
  29. ]
  30. },
  31. plugins: [
  32. new ExtractTextPlugin('styles.css'),
  33. new webpack.ProvidePlugin({
  34. $: 'jquery',
  35. jQuery: 'jquery',
  36. 'window.jQuery': 'jquery',
  37. 'window.Tether': 'tether'
  38. })
  39. ],
  40. devtool: '#eval-source-map'
  41. };
  42. if (process.env.NODE_ENV === 'production') {
  43. module.exports.devtool = false;
  44. module.exports.output.publicPath = '';
  45. module.exports.plugins = (module.exports.plugins || []).concat([
  46. new webpack.optimize.DedupePlugin(),
  47. new webpack.optimize.OccurrenceOrderPlugin(),
  48. new webpack.optimize.UglifyJsPlugin({
  49. compress: {
  50. warnings: true
  51. },
  52. output: {
  53. comments: false
  54. },
  55. sourceMap: false
  56. })
  57. ]);
  58. }