Advertisement
Guest User

Untitled

a guest
Oct 25th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. const ExtractTextPlugin = require("extract-text-webpack-plugin");
  2. const webpack = require("webpack");
  3. const path = require("path");
  4. const VueLoaderPlugin = require('vue-loader/lib/plugin');
  5. const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
  6.  
  7. module.exports = {
  8. optimization: {
  9. minimizer: [new UglifyJsPlugin({
  10. include: /\.min\.bundle\.js$/,
  11. sourceMap: false,
  12. parallel: true,
  13. })],
  14. },
  15. entry: {
  16. index: "./src/app.js",
  17. "index.min": "./src/app.js"
  18. },
  19. stats: { warnings: false }, // Hide warnings
  20. output: {
  21. path: path.resolve(__dirname, "dist"),
  22. filename: "scripts/[name].bundle.js"
  23. },
  24. module: {
  25. rules: [
  26. {
  27. test: /\.vue$/,
  28. loader: "vue-loader",
  29. options: {
  30. loaders: {
  31. // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
  32. // the "scss" and "sass" values for the lang attribute to the right configs here.
  33. // other preprocessors should work out of the box, no loader config like this necessary.
  34. scss: "vue-style-loader!css-loader!sass-loader",
  35. sass: "vue-style-loader!css-loader!sass-loader?indentedSyntax"
  36. }
  37. }
  38. },
  39. {
  40. test: /\.js$/,
  41. exclude: /(node_modules)/,
  42. use: {
  43. loader: "babel-loader",
  44. options: {
  45. presets: [
  46. [
  47. "env",
  48. {
  49. targets: {
  50. browsers: [
  51. "Chrome >= 52",
  52. "FireFox >= 44",
  53. "Safari >= 7",
  54. "Explorer 11",
  55. "last 4 Edge versions"
  56. ]
  57. },
  58. useBuiltIns: true
  59. }
  60. ],
  61. "stage-2"
  62. ]
  63. }
  64. }
  65. },
  66. {
  67. test: /\.css$/,
  68. use: ExtractTextPlugin.extract({
  69. fallback: "style-loader",
  70. use: [
  71. { loader: "css-loader", options: { importLoaders: 1 } },
  72. "postcss-loader"
  73. ]
  74. })
  75. },
  76. {
  77. test: /\.(png|svg|jpg|gif)$/,
  78. use: [
  79. {
  80. loader: "file-loader",
  81. options: {
  82. name: "img/[name].[ext]"
  83. }
  84. }
  85. ]
  86. },
  87. {
  88. test: /\.(png|woff|woff2|eot|ttf|svg)$/,
  89. use: {
  90. loader: "file-loader",
  91. options: {
  92. name: "fonts/[name].[ext]"
  93. }
  94. }
  95. }
  96. ]
  97. },
  98. resolve: {
  99. alias: {
  100. vue$: "vue/dist/vue.esm.js"
  101. }
  102. },
  103. plugins: [
  104. new VueLoaderPlugin(),
  105. new webpack.ProvidePlugin({
  106. throttle: "lodash.throttle"
  107. }),
  108. // new UglifyJsPlugin({
  109. // include: /\.min\.bundle\.js$/,
  110. //minimize: false,
  111. // ecma: 8
  112. // }),
  113. new webpack.LoaderOptionsPlugin({
  114. //minimize: true
  115. }),
  116. new ExtractTextPlugin("styles.css")
  117. ],
  118. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement