edX Hackathon 4/13/2017 Project: Insights Courses Page in Server-side Rendered React

next.config.js 841B

12345678910111213141516171819202122232425262728293031323334353637
  1. const path = require('path')
  2. const glob = require('glob')
  3. module.exports = {
  4. webpack: (config, { dev }) => {
  5. config.module.rules.push(
  6. {
  7. test: /\.(css|scss)/,
  8. loader: 'emit-file-loader',
  9. options: {
  10. name: 'dist/[path][name].[ext]'
  11. }
  12. }
  13. ,
  14. {
  15. test: /\.css$/,
  16. use: ['babel-loader', 'raw-loader', 'postcss-loader']
  17. }
  18. ,
  19. {
  20. test: /\.s(a|c)ss$/,
  21. use: ['babel-loader', 'raw-loader', 'postcss-loader',
  22. { loader: 'sass-loader',
  23. options: {
  24. includePaths: ['styles', 'node_modules']
  25. .map((d) => path.join(__dirname, d))
  26. .map((g) => glob.sync(g))
  27. .reduce((a, c) => a.concat(c), [])
  28. }
  29. }
  30. ]
  31. }
  32. )
  33. return config
  34. }
  35. }