You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

webpack.rules.ts 777B

12345678910111213141516171819202122232425262728293031
  1. import type { ModuleOptions } from 'webpack';
  2. export const rules: Required<ModuleOptions>['rules'] = [
  3. // Add support for native node modules
  4. {
  5. // We're specifying native_modules in the test because the asset relocator loader generates a
  6. // "fake" .node file which is really a cjs file.
  7. test: /native_modules[/\\].+\.node$/,
  8. use: 'node-loader',
  9. },
  10. {
  11. test: /[/\\]node_modules[/\\].+\.(m?js|node)$/,
  12. parser: { amd: false },
  13. use: {
  14. loader: '@vercel/webpack-asset-relocator-loader',
  15. options: {
  16. outputAssetBase: 'native_modules',
  17. },
  18. },
  19. },
  20. {
  21. test: /\.tsx?$/,
  22. exclude: /(node_modules|\.webpack)/,
  23. use: {
  24. loader: 'ts-loader',
  25. options: {
  26. transpileOnly: true,
  27. },
  28. },
  29. },
  30. ];