Jest:意外的令牌导入

时间:2018-01-23 06:36:32

标签: javascript node.js ecmascript-6

我已经创建并发布了我的包。

https://www.npmjs.com/package/storage-manager-es

所以,我可以在其他项目中安装它。 但是,我不能用我的包测试。因为,我得到了SyntaxError。

从&storage-manager-es / src / StorageLocal'

导入StorageLocal

从' ./ StorageInterface'

导入StorageInterface

^^^^^^

.babelrc

{
  "presets": [
    "es2015",
    "stage-0"
  ],
  "env": {
    "test": {
      "presets": ["es2015", "stage-0"]
    }
  }
}

的package.json

{
  "name": "project",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "storage-manager-es": "^1.0.4"
  },
  "scripts": {
    "test": "jest"
  },
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-jest": "^22.1.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-stage-0": "^6.24.1",
    "jest": "^22.1.4",
    "regenerator-runtime": "^0.11.1"
  },
  "jest": {
    "transform": {
      "^.+\\.js$": "babel-jest"
    }
  }
}

0 个答案:

没有答案