next.config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const path = require("path");
  2. const webpack = require("webpack");
  3. const withSass = require("@zeit/next-sass");
  4. const withCss = require("@zeit/next-css");
  5. module.exports = withSass(
  6. withCss({
  7. target: "serverless",
  8. webpack: (config) => {
  9. // Fixes npm packages that depend on `fs` module
  10. config.node = {
  11. fs: "empty",
  12. };
  13. // Resolves alias to root folder
  14. config.resolve.alias["@"] = __dirname;
  15. // Provide alias for plugins
  16. config.plugins.push(
  17. new webpack.ProvidePlugin({
  18. $: "jquery",
  19. jQuery: "jquery",
  20. "window.jQuery": "jquery",
  21. "window.moment": "moment",
  22. moment: "moment",
  23. Raphael: "raphael", // required by morris.js
  24. })
  25. );
  26. // Fix for flot resize
  27. config.module.rules.push({
  28. test: /jquery\.flot\.resize\.js$/,
  29. use: ["imports-loader?this=>window"],
  30. });
  31. // Font face support
  32. config.module.rules.push({
  33. test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
  34. use: {
  35. loader: "url-loader",
  36. options: {
  37. limit: 100000,
  38. name: "[name].[ext]",
  39. },
  40. },
  41. });
  42. return config;
  43. },
  44. })
  45. );