0
のカスタムトランスを使用しているとき、私はnpm test
(jest --watch
)を実行すると、私が手:予期しないトークン輸入バベル-冗談
C:\sites\YDR\branches\trunk\development\app\static\js\_modules\marketplace\postbacks\Components\Form.js:44
import('Form').then(function (m) {
^^^^^^
SyntaxError: Unexpected token import
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
at Object.<anonymous> (__tests__/postbacks-form.js:1:115)
package.jsonの冗談の一部:
"jest": {
"rootDir": "./../../",
"modulePaths": [
"<rootDir>tools/webpack/node_modules/",
"<rootDir>development/app/static/css/_modules/",
"<rootDir>development/app/static/js/_modules/"
],
"transform": {
"^.+\\.js$": "<rootDir>/tools/webpack/jest.transform.js"
}
}
jest.transform。 JS:私は次のバージョンを使用してい
// Custom Jest transform implementation that wraps babel-jest and injects our
// babel presets, so we don't have to use .babelrc.
module.exports = require('babel-jest').createTransformer({
presets: [
require("babel-preset-react"),
require("babel-preset-es2015")
],
plugins: [
require("babel-plugin-syntax-dynamic-import"),
]
});
:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- バベル私はまた、[email protected]を試してみたが、その後、私は別のエラーを持っている[email protected]
:
Plugin 0 specified in "base" provided an invalid property of "default"