webpack.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const MiniCssExtractPlugin = require("mini-css-extract-plugin")
  2. const path = require("path")
  3. const StyleLintPlugin = require('stylelint-webpack-plugin')
  4. const { ProvidePlugin } = require("webpack")
  5. module.exports = {
  6. cache: false,
  7. entry: "./misago/admin/src/index.js",
  8. output: {
  9. path: path.resolve(__dirname, "misago", "static", "misago", "admin"),
  10. filename: "index.js"
  11. },
  12. resolve: {
  13. alias: {
  14. moment$: path.resolve(__dirname, "node_modules", "moment", "min", "moment.min.js")
  15. }
  16. },
  17. module: {
  18. rules: [
  19. {
  20. enforce: "pre",
  21. test: /\.js$/,
  22. exclude: /(node_modules)/,
  23. loader: 'eslint-loader'
  24. },
  25. {
  26. test: /\.js$/,
  27. exclude: /(node_modules)/,
  28. loader: 'babel-loader'
  29. },
  30. {
  31. test: /\.(sa|sc|c)ss$/,
  32. use: [
  33. MiniCssExtractPlugin.loader,
  34. "css-loader",
  35. {
  36. loader: "postcss-loader",
  37. options: {
  38. plugins: function() {
  39. return [
  40. require("autoprefixer")
  41. ]
  42. }
  43. }
  44. },
  45. "sass-loader"
  46. ]
  47. }
  48. ]
  49. },
  50. plugins: [
  51. new StyleLintPlugin({
  52. configFile: "./node_modules/stylelint-config-twbs-bootstrap/scss/index.js"
  53. }),
  54. new MiniCssExtractPlugin({
  55. filename: "index.css"
  56. })
  57. ]
  58. }