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.2 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
81
82
83
84
85
86
87
  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.js',
  9. output: {
  10. filename: 'index.js',
  11. path: path.resolve(__dirname, 'dist'),
  12. publicPath: '/dist'
  13. },
  14. stats: 'errors-only',
  15. module: {
  16. rules: [
  17. {
  18. test: /\.m?js$/,
  19. exclude: /(node_modules)/,
  20. use: {
  21. loader: 'babel-loader',
  22. options: {
  23. exclude: /node_modules\/lodash/,
  24. presets: [
  25. ['@babel/preset-env', { targets: '> 0.25%, not dead' }]
  26. ],
  27. plugins: [
  28. '@babel/transform-runtime'
  29. ]
  30. }
  31. }
  32. },
  33. {
  34. test: /\.css$/i,
  35. use: ['style-loader', 'css-loader']
  36. },
  37. {
  38. test: /\.s[ac]ss$/i,
  39. use: [
  40. MiniCssExtractPlugin.loader,
  41. {
  42. loader: 'css-loader',
  43. options: {
  44. sourceMap: true,
  45. url: false
  46. }
  47. },
  48. {
  49. // Needed to resolve image url()s within @primer/css
  50. loader: 'resolve-url-loader',
  51. options: {}
  52. },
  53. {
  54. loader: 'sass-loader',
  55. options: {
  56. sassOptions: {
  57. includePaths: ['./stylesheets', './node_modules'],
  58. options: {
  59. sourceMap: true,
  60. sourceMapContents: false
  61. }
  62. }
  63. }
  64. }
  65. ]
  66. }
  67. ]
  68. },
  69. plugins: [
  70. new MiniCssExtractPlugin({
  71. filename: 'index.css'
  72. }),
  73. new CopyWebpackPlugin({
  74. patterns: [
  75. { from: 'node_modules/@primer/css/fonts', to: 'fonts' }
  76. ]
  77. }),
  78. new EnvironmentPlugin({
  79. NODE_ENV: 'development', // use 'development' unless process.env.NODE_ENV is defined
  80. DEBUG: false
  81. }),
  82. new ProvidePlugin({
  83. process: 'process/browser'
  84. })
  85. ]
  86. }
Tip!

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

Comments

Loading...