Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. const path = require('path');
  2. const HtmlWebpackPlugin = require('html-webpack-plugin');
  3. module.exports = {
  4.  
  5. // webpack will take the files from ./src/index
  6. entry: './src/index',
  7.  
  8. // and output it into /dist as bundle.js
  9. output: {
  10. path: path.join(__dirname, '/dist'),
  11. filename: 'bundle.js'
  12. },
  13.  
  14. // adding .ts and .tsx to resolve.extensions will help babel look for .ts and .tsx files to transpile
  15. resolve: {
  16. extensions: ['.ts', '.tsx', '.js']
  17. },
  18.  
  19. module: {
  20. rules: [
  21.  
  22. // we use babel-loader to load our jsx and tsx files
  23. {
  24. test: /\.(ts|js)x?$/,
  25. exclude: /node_modules/,
  26. use: {
  27. loader: 'babel-loader'
  28. },
  29. },
  30.  
  31. // css-loader to bundle all the css files into one file and style-loader to add all the styles inside the style tag of the document
  32. {
  33. test: /\.css$/,
  34. use: ['style-loader', 'css-loader']
  35. }
  36. ]
  37. },
  38. plugins: [
  39. new HtmlWebpackPlugin({
  40. template: './src/index.html'
  41. })
  42. ]
  43. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement