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.

111 lines
2.5 KiB

10 years ago
8 years ago
10 years ago
8 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
8 years ago
10 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
10 years ago
  1. var path = require('path')
  2. var webpack = require('webpack')
  3. module.exports = {
  4. entry: './src/main.js',
  5. output: {
  6. path: path.resolve(__dirname, './dist'),
  7. publicPath: '/dist/',
  8. filename: 'build.js'
  9. },
  10. module: {
  11. rules: [
  12. {
  13. test: /\.css$/,
  14. use: [
  15. 'vue-style-loader',
  16. 'css-loader'
  17. ],
  18. },{{#sass}}
  19. {
  20. test: /\.scss$/,
  21. use: [
  22. 'vue-style-loader',
  23. 'css-loader',
  24. 'sass-loader'
  25. ],
  26. },
  27. {
  28. test: /\.sass$/,
  29. use: [
  30. 'vue-style-loader',
  31. 'css-loader',
  32. 'sass-loader?indentedSyntax'
  33. ],
  34. },
  35. {{/sass}}
  36. {
  37. test: /\.vue$/,
  38. loader: 'vue-loader',
  39. options: {
  40. loaders: {
  41. {{#sass}}
  42. // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
  43. // the "scss" and "sass" values for the lang attribute to the right configs here.
  44. // other preprocessors should work out of the box, no loader config like this necessary.
  45. 'scss': [
  46. 'vue-style-loader',
  47. 'css-loader',
  48. 'sass-loader'
  49. ],
  50. 'sass': [
  51. 'vue-style-loader',
  52. 'css-loader',
  53. 'sass-loader?indentedSyntax'
  54. ]
  55. {{/sass}}
  56. }
  57. // other vue-loader options go here
  58. }
  59. },
  60. {
  61. test: /\.js$/,
  62. loader: 'babel-loader',
  63. exclude: /node_modules/
  64. },
  65. {
  66. test: /\.(png|jpg|gif|svg)$/,
  67. loader: 'file-loader',
  68. options: {
  69. name: '[name].[ext]?[hash]'
  70. }
  71. }
  72. ]
  73. },
  74. resolve: {
  75. alias: {
  76. 'vue$': 'vue/dist/vue.esm.js'
  77. },
  78. extensions: ['*', '.js', '.vue', '.json']
  79. },
  80. devServer: {
  81. historyApiFallback: true,
  82. noInfo: true,
  83. overlay: true
  84. },
  85. performance: {
  86. hints: false
  87. },
  88. devtool: '#eval-source-map'
  89. }
  90. if (process.env.NODE_ENV === 'production') {
  91. module.exports.devtool = '#source-map'
  92. // http://vue-loader.vuejs.org/en/workflow/production.html
  93. module.exports.plugins = (module.exports.plugins || []).concat([
  94. new webpack.DefinePlugin({
  95. 'process.env': {
  96. NODE_ENV: '"production"'
  97. }
  98. }),
  99. new webpack.optimize.UglifyJsPlugin({
  100. sourceMap: true,
  101. compress: {
  102. warnings: false
  103. }
  104. }),
  105. new webpack.LoaderOptionsPlugin({
  106. minimize: true
  107. })
  108. ])
  109. }