webpack.dev.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * @author: Yuki Takei <yuki@weseek.co.jp>
  3. */
  4. const webpack = require('webpack');
  5. const helpers = require('../src/lib/util/helpers');
  6. /*
  7. * Webpack Plugins
  8. */
  9. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  10. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  11. /**
  12. * Webpack Constants
  13. */
  14. const ANALYZE = process.env.ANALYZE;
  15. module.exports = require('./webpack.common')({
  16. mode: 'development',
  17. devtool: 'cheap-module-eval-source-map',
  18. entry: {
  19. 'js/dev': './src/client/js/dev',
  20. },
  21. resolve: {
  22. modules: ['../node_modules'],
  23. },
  24. module: {
  25. rules: [
  26. {
  27. test: /\.(sc|sa|c)ss$/,
  28. use: [
  29. 'style-loader',
  30. { loader: 'css-loader', options: { sourceMap: true } },
  31. { loader: 'sass-loader', options: { sourceMap: true } },
  32. ],
  33. include: [helpers.root('src/client')],
  34. exclude: [helpers.root('src/client/styles/hackmd')],
  35. },
  36. { // Dump CSS for HackMD
  37. test: /\.(sc|sa|c)ss$/,
  38. use: [
  39. MiniCssExtractPlugin.loader,
  40. 'css-loader',
  41. 'sass-loader'
  42. ],
  43. include: [helpers.root('src/client/styles/hackmd')]
  44. },
  45. ],
  46. },
  47. plugins: [
  48. new MiniCssExtractPlugin({
  49. filename: '[name].bundle.css',
  50. }),
  51. new webpack.DllReferencePlugin({
  52. context: helpers.root(),
  53. manifest: require(helpers.root('public/dll', 'manifest.json')),
  54. }),
  55. new BundleAnalyzerPlugin({
  56. analyzerMode: ANALYZE ? 'server' : 'disabled',
  57. }),
  58. ],
  59. optimization: {},
  60. performance: {
  61. hints: false
  62. }
  63. });