Issue 1:
This is another regression we noticed at switching v5.5.8.

With a child visitor, we'd like to replace nested calls with strings:

foo(bar('x'));

To:

foo('{x}');

With a (simplified here) transform:

module.exports = new Transformer('foo', {
CallExpression: function(node, parent, scope) {
scope.traverse(node, childCallVisitor, {});
}
});

var childCallVisitor = {
CallExpression: {
enter: function(node) {
return t.literal('{' + node['arguments'][0].value + '}');
}
}
};

The stack-trace:

TypeError: /Users/dmitrys/test.js: Cannot set property '0' of null
at NodePath.replaceWith (.../babel/node_modules/babel-core/lib/babel/traversal/path/replacement.js:170:40)
at NodePath.call (.../babel/node_modules/babel-core/lib/babel/traversal/path/context.js:125:12)
at NodePath.visit (.../babel/node_modules/babel-core/lib/babel/traversal/path/context.js:146:8)
at TraversalContext.visitMultiple (.../babel/node_modules/babel-core/lib/babel/traversal/context.js:85:16)
at TraversalContext.visit (.../babel/node_modules/babel-core/lib/babel/traversal/context.js:115:19)
at Function.traverse.node (.../babel/node_modules/babel-core/lib/babel/traversal/index.js:67:17)
at traverse (.../babel/node_modules/babel-core/lib/babel/traversal/index.js:50:14)
at Scope.traverse (.../babel/node_modules/babel-core/lib/babel/traversal/scope/index.js:219:28)
at NodePath.module.exports.Transformer.CallExpression (...fb-transforms/babel-plugin-fbt/index.js:12:11)
at NodePath.call (.../babel/node_modules/babel-core/lib/babel/traversal/path/context.js:122:26)

If we have more complex expression, it works:

foo(bar('x') + ' y');

Normally transforms to:

foo('{x}' + 'y');

Issue 2:
Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):

SyntaxError: D:\my-app\src\index.js: Unexpected token (9:2).

when using react with decorators

package.json

{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/core": "7.5.5",
"@material-ui/core": "^4.3.3",
"@svgr/webpack": "4.3.2",
"@typescript-eslint/eslint-plugin": "1.13.0",
"@typescript-eslint/parser": "1.13.0",
"babel-eslint": "10.0.2",
"babel-jest": "^24.8.0",
"babel-plugin-named-asset-import": "^0.3.3",
"babel-preset-react-app": "^9.0.1",
"camelcase": "^5.2.0",
"case-sensitive-paths-webpack-plugin": "2.2.0",
"css-loader": "2.1.1",
"dotenv": "6.2.0",
"dotenv-expand": "4.2.0",
"eslint": "^6.1.0",
"eslint-config-react-app": "^5.0.1",
"eslint-loader": "2.2.1",
"eslint-plugin-flowtype": "3.13.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-react": "7.14.3",
"eslint-plugin-react-hooks": "^1.6.1",
"file-loader": "3.0.1",
"fs-extra": "7.0.1",
"html-webpack-plugin": "4.0.0-beta.5",
"identity-obj-proxy": "3.0.0",
"is-wsl": "^1.1.0",
"jest": "24.8.0",
"jest-environment-jsdom-fourteen": "0.1.0",
"jest-resolve": "24.8.0",
"jest-watch-typeahead": "0.3.1",
"mini-css-extract-plugin": "0.5.0",
"mobx": "^5.13.0",
"mobx-react": "^6.1.3",
"optimize-css-assets-webpack-plugin": "5.0.3",
"pnp-webpack-plugin": "1.5.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-normalize": "7.0.1",
"postcss-preset-env": "6.7.0",
"postcss-safe-parser": "4.0.1",
"react": "^16.9.0",
"react-app-polyfill": "^1.0.2",
"react-dev-utils": "^9.0.3",
"react-dom": "^16.9.0",
"resolve": "1.12.0",
"resolve-url-loader": "3.1.0",
"sass-loader": "7.2.0",
"semver": "6.3.0",
"style-loader": "1.0.0",
"terser-webpack-plugin": "1.4.1",
"ts-pnp": "1.1.2",
"url-loader": "2.1.0",
"webpack": "4.39.1",
"webpack-dev-server": "3.2.1",
"webpack-manifest-plugin": "2.0.4",
"workbox-webpack-plugin": "4.3.1"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "7.5.5",
"@babel/preset-env": "7.5.5",
"babel-loader": "8.0.6",
"@babel/plugin-proposal-class-properties": "7.5.5",
"@babel/plugin-proposal-decorators": "^7.4.4",
"vuex-module-decorators": "^0.10.1"
},
"babel": {
"presets": [
"@babel/preset-env", "@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
]
]
},
"jest": {
"roots": [
"<rootDir>/src"
],
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!src/**/*.d.ts"
],
"setupFiles": [
"react-app-polyfill/jsdom"
],
"setupFilesAfterEnv": [],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
],
"testEnvironment": "jest-environment-jsdom-fourteen",
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
"^.+\\.module\\.(css|sass|scss)$"
],
"modulePaths": [],
"moduleNameMapper": {
"^react-native$": "react-native-web",
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
},
"moduleFileExtensions": [
"web.js",
"js",
"web.ts",
"ts",
"web.tsx",
"tsx",
"json",
"web.jsx",
"jsx",
"node"
],
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
}
}