New

Untitled clip

1672 chars
November 2016
163 views
Reclip Copy RAW
  1. var path = require('path')
  2. var webpack = require('webpack')
  3.  
  4. module.exports = {
  5. entry: './OnlineForms/Js/src/main.js',
  6. output: {
  7. path: path.resolve(__dirname, './OnlineForms/Dist'),
  8. publicPath: '/dist/',
  9. filename: 'build.js'
  10. },
  11. plugins: [new (require('html-webpack-plugin'))({
  12. title: 'Online Forms',
  13. template: './OnlineForms/Js/assets/index.html',
  14. hash: false
  15. })],
  16. module: {
  17. loaders: [
  18. { test: /\.css$/, loader: "style!css" },
  19. ],
  20. rules: [
  21. {
  22. test: /\.vue$/,
  23. loader: 'vue',
  24. options: {
  25. // vue-loader options go here
  26. }
  27. },{
  28. test: /\.js$/,
  29. loader: 'babel',
  30. exclude: /node_modules/
  31. },{
  32. test: /\.(png|jpg|gif|svg)$/,
  33. loader: 'file',
  34. options: {
  35. name: '[name].[ext]?[hash]'
  36. }
  37. },{
  38. test: /\.less$/,
  39. loader: "style!css!less"
  40. }
  41. ]
  42. },
  43. resolve: {
  44. alias: {
  45. 'vue$': 'vue/dist/vue'
  46. }
  47. },
  48. devtool: '#eval-source-map'
  49. }
  50.  
  51. if (process.env.NODE_ENV === 'production') {
  52. module.exports.devtool = '#source-map'
  53. // http://vue-loader.vuejs.org/en/workflow/production.html
  54. module.exports.plugins = (module.exports.plugins || [])
  55. .map((plugin) => {
  56. if(plugin.hash === false) {
  57. plugin.hash = true;
  58. }
  59. return plugin;
  60. }).concat([
  61. new webpack.DefinePlugin({
  62. 'process.env': {
  63. NODE_ENV: '"production"'
  64. }
  65. }),
  66. new webpack.optimize.UglifyJsPlugin({
  67. compress: {
  68. warnings: false
  69. }
  70. }),
  71. new webpack.LoaderOptionsPlugin({
  72. minimize: true
  73. })
  74. ])
  75. }
  76.