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.
 
 
 
 
 
 

56 lines
1.5 KiB

  1. const path = require("path");
  2. const webpack = require("webpack");
  3. const HtmlWebpackPlugin = require("html-webpack-plugin");
  4. const { CleanWebpackPlugin } = require("clean-webpack-plugin");
  5. const VueLoaderPlugin = require("vue-loader/lib/plugin");
  6. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  7. const productionMode = process.env.NODE_ENV === "production";
  8. module.exports = {
  9. entry: "./src/main.js",
  10. resolve: {
  11. modules: [path.resolve(__dirname, "src"), "node_modules"]
  12. },
  13. plugins: [
  14. new MiniCssExtractPlugin({ filename: "lesspass.min.css" }),
  15. new CleanWebpackPlugin(),
  16. new HtmlWebpackPlugin({ template: "./src/index.html", inject: "body" }),
  17. new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
  18. new VueLoaderPlugin()
  19. ],
  20. output: {
  21. filename: "lesspass.min.js",
  22. path: path.resolve(__dirname, "dist")
  23. },
  24. module: {
  25. rules: [
  26. {
  27. test: /\.vue$/,
  28. loader: "vue-loader"
  29. },
  30. {
  31. test: /\.js$/,
  32. exclude: /node_modules\/(?!copy-text-to-clipboard)/,
  33. loader: "babel-loader"
  34. },
  35. {
  36. test: /\.(sa|sc|c)ss$/,
  37. use: [
  38. productionMode ? MiniCssExtractPlugin.loader : "style-loader",
  39. "css-loader",
  40. "sass-loader"
  41. ]
  42. },
  43. {
  44. test: /\.(png|svg|jpg|gif|ico)$/,
  45. use: ["file-loader?name=[name].[ext]"]
  46. },
  47. {
  48. test: /\.(woff|woff2|eot|ttf|otf)$/,
  49. use: ["file-loader"]
  50. },
  51. { test: /\.html$/, loader: "raw-loader" }
  52. ]
  53. }
  54. };