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.
 
 
 
 
 
 

49 lines
1.9 KiB

  1. var webpack = require('webpack');
  2. var OfflinePlugin = require('offline-plugin');
  3. module.exports = {
  4. context: __dirname + "/app",
  5. entry: ["./main.js"],
  6. output: {
  7. path: __dirname + "/dist",
  8. publicPath: '/dist/',
  9. filename: "bundle.js"
  10. },
  11. module: {
  12. loaders: [
  13. {test: /\.vue$/, loader: 'vue'},
  14. {test: /\.js$/, loader: 'babel', exclude: /node_modules/},
  15. {test: /\.json$/, loader: 'json'},
  16. {test: /\.(png|jpg|gif)$/, loader: 'url', query: {limit: 11000, name: '[name].[ext]?[hash]'}},
  17. {test: /\.css$/, loader: 'style-loader!css-loader'},
  18. {test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff"},
  19. {test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff"},
  20. {test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream"},
  21. {test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file"},
  22. {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml"}
  23. ]
  24. },
  25. plugins: [
  26. new webpack.ProvidePlugin({
  27. $: "jquery",
  28. jQuery: "jquery",
  29. "window.jQuery": "jquery"
  30. })
  31. ]
  32. };
  33. if (process.env.NODE_ENV === 'production') {
  34. module.exports.plugins = (module.exports.plugins || []).concat([
  35. new webpack.DefinePlugin({'process.env': {NODE_ENV: '"production"'}}),
  36. new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}, comments: false}),
  37. new webpack.optimize.OccurenceOrderPlugin(),
  38. new webpack.optimize.DedupePlugin(),
  39. new OfflinePlugin({
  40. caches: 'all',
  41. scope: '/dist/',
  42. updateStrategy: 'all',
  43. ServiceWorker: { output: 'sw.js'},
  44. AppCache: false
  45. })
  46. ])
  47. }