Guest User

Untitled

a guest
Dec 7th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. var path = require('path')
  2. var webpack = require('webpack')
  3.  
  4. module.exports = {
  5. entry: {
  6. app: './src/main.js',
  7. vendor: ['vue', 'axios', 'popper.js', 'pace', 'vue-router', 'jquery'],
  8. sass: './src/bootstrap.scss',
  9. },
  10. output: {
  11. path: path.resolve(__dirname, './dist'),
  12. publicPath: '/dist/',
  13. filename: '[name].js'
  14. },
  15. module: {
  16. rules: [
  17. {
  18. test: /.css$/,
  19. use: [
  20. 'vue-style-loader',
  21. 'css-loader'
  22. ],
  23. },
  24. {
  25. test: /.scss$/,
  26. use: [
  27. 'vue-style-loader',
  28. 'css-loader',
  29. 'sass-loader'
  30. ],
  31. },
  32. {
  33. test: /.sass$/,
  34. use: [
  35. 'vue-style-loader',
  36. 'css-loader',
  37. 'sass-loader?indentedSyntax'
  38. ],
  39. },
  40. {
  41. test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/,
  42. use: [
  43. 'url-loader'
  44. ],
  45. },
  46. {
  47. test: /.(ttf|eot|svg)(?v=[0-9].[0-9].[0-9])?$/,
  48. use: [
  49. 'file-loader'
  50. ],
  51. },
  52. {
  53. test: /.vue$/,
  54. loader: 'vue-loader',
  55. options: {
  56. loaders: {
  57. // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
  58. // the "scss" and "sass" values for the lang attribute to the right configs here.
  59. // other preprocessors should work out of the box, no loader config like this necessary.
  60. 'scss': [
  61. 'vue-style-loader',
  62. 'css-loader',
  63. 'sass-loader'
  64. ],
  65. 'sass': [
  66. 'vue-style-loader',
  67. 'css-loader',
  68. 'sass-loader?indentedSyntax'
  69. ]
  70. }
  71. // other vue-loader options go here
  72. }
  73. },
  74. {
  75. test: /.js$/,
  76. loader: 'babel-loader',
  77. exclude: /node_modules/
  78. },
  79. {
  80. test: /.(png|jpg|gif|svg)$/,
  81. loader: 'file-loader',
  82. options: {
  83. name: '[name].[ext]?[hash]'
  84. }
  85. }
  86. ]
  87. },
  88. resolve: {
  89. alias: {
  90. 'vue$': 'vue/dist/vue.esm.js'
  91. },
  92. extensions: ['*', '.js', '.vue', '.json']
  93. },
  94. plugins: [
  95. new webpack.optimize.CommonsChunkPlugin({
  96. names: ['vendor']
  97. })
  98. ],
  99. devServer: {
  100. historyApiFallback: true,
  101. noInfo: true,
  102. overlay: true
  103. },
  104. performance: {
  105. hints: false
  106. },
  107. devtool: '#eval-source-map'
  108. }
  109.  
  110. if (process.env.NODE_ENV === 'production') {
  111. module.exports.devtool = '#source-map'
  112. // http://vue-loader.vuejs.org/en/workflow/production.html
  113. module.exports.plugins = (module.exports.plugins || []).concat([
  114. new webpack.DefinePlugin({
  115. 'process.env': {
  116. NODE_ENV: '"production"'
  117. }
  118. }),
  119. new webpack.optimize.UglifyJsPlugin({
  120. sourceMap: true,
  121. compress: {
  122. warnings: false
  123. }
  124. }),
  125. new webpack.LoaderOptionsPlugin({
  126. minimize: true
  127. })
  128. ])
  129. }
Add Comment
Please, Sign In to add comment