Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

webpack.config.js 2.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  1. const path = require('path')
  2. const MiniCssExtractPlugin = require('mini-css-extract-plugin')
  3. const CopyWebpackPlugin = require('copy-webpack-plugin')
  4. const { EnvironmentPlugin, ProvidePlugin } = require('webpack')
  5. module.exports = {
  6. mode: 'development',
  7. devtool: process.env.NODE_ENV === 'development' ? 'eval' : 'source-map', // no 'eval' outside of development
  8. entry: './javascripts/index.ts',
  9. output: {
  10. filename: 'index.js',
  11. path: path.resolve(__dirname, 'dist'),
  12. publicPath: '/dist'
  13. },
  14. stats: 'errors-only',
  15. resolve: {
  16. extensions: ['.tsx', '.ts', '.js', '.css', '.scss']
  17. },
  18. module: {
  19. rules: [
  20. {
  21. test: /\.tsx?$/,
  22. use: 'ts-loader',
  23. exclude: /node_modules/
  24. },
  25. {
  26. test: /\.css$/i,
  27. use: ['style-loader', 'css-loader']
  28. },
  29. {
  30. test: /\.s[ac]ss$/i,
  31. use: [
  32. MiniCssExtractPlugin.loader,
  33. {
  34. loader: 'css-loader',
  35. options: {
  36. sourceMap: true,
  37. url: false
  38. }
  39. },
  40. {
  41. // Needed to resolve image url()s within @primer/css
  42. loader: 'resolve-url-loader',
  43. options: {}
  44. },
  45. {
  46. loader: 'sass-loader',
  47. options: {
  48. sassOptions: {
  49. quietDeps: true,
  50. includePaths: ['./stylesheets', './node_modules'],
  51. options: {
  52. sourceMap: true,
  53. sourceMapContents: false
  54. }
  55. }
  56. }
  57. }
  58. ]
  59. }
  60. ]
  61. },
  62. plugins: [
  63. new MiniCssExtractPlugin({
  64. filename: 'index.css'
  65. }),
  66. new CopyWebpackPlugin({
  67. patterns: [
  68. { from: 'node_modules/@primer/css/fonts', to: 'fonts' }
  69. ]
  70. }),
  71. new EnvironmentPlugin({
  72. NODE_ENV: 'development', // use 'development' unless process.env.NODE_ENV is defined
  73. DEBUG: false
  74. }),
  75. new ProvidePlugin({
  76. process: 'process/browser'
  77. })
  78. ]
  79. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...