webpack.config.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import path from 'path';
  2. import webpack from 'webpack';
  3. // tslint:disable-next-line:no-var-requires
  4. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  5. const config: webpack.Configuration = {
  6. mode: 'production',
  7. entry: {
  8. main: './assets/scripts/main.ts',
  9. intro: './assets/scripts/intro/intro.ts',
  10. },
  11. output: {
  12. path: path.resolve(__dirname, 'static'),
  13. filename: '[name].js',
  14. },
  15. resolve: {
  16. extensions: ['.ts', '.js'],
  17. },
  18. module: {
  19. rules: [
  20. { test: /\.tsx?$/, loader: 'ts-loader' },
  21. {
  22. test: /\.scss$/,
  23. use: [
  24. {
  25. loader: MiniCssExtractPlugin.loader,
  26. },
  27. 'css-loader',
  28. 'sass-loader',
  29. ],
  30. },
  31. ],
  32. },
  33. plugins: [
  34. new MiniCssExtractPlugin({
  35. // Options similar to the same options in webpackOptions.output
  36. // both options are optional
  37. filename: '[name].css',
  38. chunkFilename: '[id].css',
  39. }),
  40. ],
  41. devtool: 'source-map',
  42. };
  43. export default config;