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.

webpack.config.js 2.3 KiB

8 anni fa
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: 'lesspass.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: 'file-loader?name=[name].[ext]',},
  27. {test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader')},
  28. {test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  29. {test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  30. {test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/octet-stream'},
  31. {test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'},
  32. {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=image/svg+xml'},
  33. ]
  34. },
  35. plugins: [
  36. new ExtractTextPlugin('lesspass.css'),
  37. new webpack.ProvidePlugin({
  38. $: 'jquery',
  39. jQuery: 'jquery',
  40. 'window.jQuery': 'jquery',
  41. 'window.Tether': 'tether'
  42. })
  43. ],
  44. devtool: '#eval-source-map'
  45. };
  46. if (process.env.NODE_ENV === 'production') {
  47. module.exports.devtool = false;
  48. module.exports.plugins = (module.exports.plugins || []).concat([
  49. new webpack.optimize.DedupePlugin(),
  50. new webpack.optimize.OccurrenceOrderPlugin(),
  51. new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
  52. new webpack.optimize.UglifyJsPlugin({
  53. compress: {
  54. warnings: true
  55. },
  56. output: {
  57. comments: false
  58. },
  59. sourceMap: false
  60. })
  61. ]);
  62. }