Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

50 righe
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|svg)$/, loader: 'url', query: {limit: 10000, 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. version: 'v1',
  44. ServiceWorker: { output: 'sw.js'},
  45. AppCache: {directory: 'appcache/'}
  46. })
  47. ])
  48. }