webpack.common.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const babelOptions = {
  4. presets: [
  5. ['@babel/preset-env', {
  6. corejs: 3,
  7. useBuiltIns: 'entry',
  8. targets: {
  9. firefox: 60,
  10. chrome: 65,
  11. opera: 52,
  12. safari: 11,
  13. },
  14. }],
  15. ],
  16. plugins: [
  17. ['@babel/plugin-transform-runtime', {
  18. regenerator: true,
  19. }],
  20. ['@babel/plugin-syntax-dynamic-import'],
  21. ],
  22. };
  23. module.exports = {
  24. entry: {
  25. app: './src/bootstrap.ts',
  26. },
  27. module: {
  28. rules: [
  29. {
  30. test: /\.ts$/,
  31. exclude: /node_modules/,
  32. use: [
  33. {loader: 'babel-loader', options: babelOptions},
  34. {loader: 'ts-loader'},
  35. ],
  36. },
  37. {
  38. test: /\.js$/,
  39. exclude: /node_modules/,
  40. use: [
  41. {loader: 'babel-loader', options: babelOptions},
  42. ],
  43. },
  44. ],
  45. },
  46. resolve: {
  47. extensions: ['.js', '.ts', '.wasm'],
  48. },
  49. output: {
  50. path: path.resolve(__dirname, 'dist', 'generated'),
  51. filename: '[name].bundle.js',
  52. chunkFilename: '[name].[chunkhash].bundle.js',
  53. },
  54. };