Импорт экспорта по умолчанию не определен - PullRequest
0 голосов
/ 05 июля 2019

Я использую TypeScript с Babel 7, Webpack 4 и React.

export default () => <span>Test</span>

А затем

import Test from './test'

Тест проводится вэта точка не определена или с plugin-transform-modules-commonjs пустым объектом.

.babelrc

  "plugins": [
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-object-rest-spread",
    "@babel/plugin-transform-arrow-functions",
    "@babel/plugin-transform-modules-commonjs",
    "react-hot-loader/babel"
  ],
  "presets": [
    "@babel/preset-react",
    "@babel/preset-typescript",
    ["@babel/preset-env", {
      "targets": {
        "browsers": "> 0.5%, last 2 versions, Firefox ESR, ie 11, not dead"
      }
    }]
  ]
}

tsconfig.json

{
    "compilerOptions": {
    "module": "common",
    "target": "es5",
    "noEmit": true,
    "strict": true,
    "skipLibCheck": true,
    "baseUrl": "./",
    "paths": {
      "*": ["declarations"]
    }
  },
  "include": [
    "src"
  ],
  "exclude": [
    "node_modules"
  ]
}
...