.babelrc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. {
  2. "presets": [
  3. [
  4. "@babel/preset-env",
  5. {
  6. "targets":
  7. {
  8. "edge": "17",
  9. "firefox": "60",
  10. "chrome": "67",
  11. "ie": "11"
  12. }
  13. }
  14. ],
  15. "@babel/preset-react",
  16. "@babel/preset-typescript",
  17. "@babel/preset-flow"
  18. ],
  19. "plugins": [
  20. ["@babel/plugin-proposal-decorators", {"legacy": true}], // 支持装饰器写法
  21. ["@babel/plugin-proposal-class-properties", {"loose": true}],
  22. "@babel/plugin-transform-runtime",
  23. "@babel/plugin-transform-arrow-functions",
  24. "babel-plugin-add-module-exports", // 支持export default 这样的 es 模块写法
  25. "@babel/plugin-transform-modules-umd",
  26. "@babel/plugin-proposal-export-namespace-from",
  27. "@babel/plugin-proposal-function-sent",
  28. "@babel/plugin-proposal-json-strings",
  29. "@babel/plugin-proposal-numeric-separator",
  30. "@babel/plugin-proposal-throw-expressions",
  31. "@babel/plugin-syntax-dynamic-import",
  32. "@babel/plugin-syntax-jsx",
  33. "@babel/plugin-proposal-optional-chaining",
  34. "@babel/plugin-proposal-nullish-coalescing-operator"
  35. ]
  36. }