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.
 
 
 
 
 
 

72 righe
2.1 KiB

  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: 'bundle.js'
  10. },
  11. resolve: {
  12. extensions: ['', '.js', '.vue'],
  13. fallback: [path.join(__dirname, 'node_modules')],
  14. alias: {
  15. src: path.resolve(__dirname, './src')
  16. }
  17. },
  18. resolveLoader: {
  19. root: path.join(__dirname, 'node_modules')
  20. },
  21. module: {
  22. loaders: [
  23. {test: /\.vue$/, loader: 'vue-loader'},
  24. {test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'},
  25. {test: /\.json$/, loader: "json-loader"},
  26. {test: /\.(png|jpg|jpeg|gif)$/, loader: 'url?limit=10000&name=images/[name].[ext]',},
  27. {test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader")},
  28. {test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/, loader: 'file-loader'}
  29. ]
  30. },
  31. plugins: [
  32. new ExtractTextPlugin("styles.css"),
  33. new webpack.ProvidePlugin({
  34. $: 'jquery',
  35. jQuery: 'jquery',
  36. 'window.jQuery': 'jquery',
  37. 'Tether': 'tether',
  38. 'window.Tether': 'tether'
  39. })
  40. ],
  41. devServer: {
  42. historyApiFallback: true,
  43. noInfo: true
  44. },
  45. devtool: '#eval-source-map'
  46. };
  47. if (process.env.NODE_ENV === 'production') {
  48. module.exports.devtool = false;
  49. module.exports.output.publicPath = '';
  50. module.exports.plugins = (module.exports.plugins || []).concat([
  51. new webpack.DefinePlugin({
  52. 'process.env': {
  53. NODE_ENV: '"production"'
  54. }
  55. }),
  56. new webpack.optimize.DedupePlugin(),
  57. new webpack.optimize.OccurrenceOrderPlugin(),
  58. new webpack.optimize.UglifyJsPlugin({
  59. compress: {
  60. warnings: true
  61. },
  62. output: {
  63. comments: false
  64. },
  65. sourceMap: false
  66. })
  67. ]);
  68. }