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.
 
 
 
 
 
 

61 lines
1.4 KiB

  1. var webpack = require('webpack');
  2. module.exports = {
  3. entry: './app/main.js',
  4. output: {
  5. path: './dist',
  6. publicPath: '/dist/',
  7. filename: 'app.js'
  8. },
  9. devServer: {
  10. port: 8080
  11. },
  12. module: {
  13. loaders: [
  14. {
  15. test: /\.scss$/,
  16. loaders: ['css', 'sass']
  17. },
  18. {
  19. test: /\.js$/,
  20. exclude: /node_modules|vue\/dist|vue-router\/|vue-loader\/|vue-hot-reload-api\//,
  21. loader: 'babel'
  22. },
  23. {
  24. test: /\.vue$/,
  25. loader: 'vue'
  26. },
  27. {
  28. test: /\.(png|jpe?g|gif)$/,
  29. loader: 'url',
  30. query: {
  31. limit: 10000,
  32. name: '[name].[ext]?[hash]'
  33. }
  34. }
  35. ]
  36. },
  37. babel: {
  38. presets: ['es2015'],
  39. plugins: ['transform-runtime']
  40. }
  41. };
  42. if (process.env.NODE_ENV === 'production') {
  43. module.exports.plugins = [
  44. new webpack.DefinePlugin({
  45. 'process.env': {
  46. NODE_ENV: '"production"'
  47. }
  48. }),
  49. new webpack.optimize.UglifyJsPlugin({
  50. compress: {
  51. warnings: false
  52. },
  53. comments: false
  54. }),
  55. new webpack.optimize.OccurenceOrderPlugin()
  56. ]
  57. } else {
  58. module.exports.devtool = '#source-map'
  59. }