Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(babel): keep function names to improve stack traces in tests #189

Merged
merged 2 commits into from Jan 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/config/babelrc.js
Expand Up @@ -81,7 +81,7 @@ module.exports = () => ({
? require.resolve('babel-plugin-transform-inline-environment-variables')
: null,
[require.resolve('@babel/plugin-proposal-class-properties'), {loose: true}],
require.resolve('babel-plugin-minify-dead-code-elimination'),
['babel-plugin-minify-dead-code-elimination', {keepFnName: isTest}],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add:

const isMinify = parseEnv('BUILD_MINIFY', false)

Above, and then change this to:

Suggested change
['babel-plugin-minify-dead-code-elimination', {keepFnName: isTest}],
isMinify ? require.resolve('babel-plugin-minify-dead-code-elimination') : null,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Also, I didn't even notice I have removed the require.resolve in my first commit 😅

P.S. I would have taken your suggestion if it were possible to add the parseEnv at the same time.

treeshake
? null
: require.resolve('@babel/plugin-transform-modules-commonjs'),
Expand Down