You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building an app using electron 1.4.13. I'm using babel-preset-env to target babel to the current node release (7.3.0) for transpilation of electron's main process code. (Main process code doesn't need to be bundled into a single file and can use require.)
In the main process code, I want to use NODE_ENV to include/exclude code based on the build target. I see there are two ways to do this: babel-plugin-transform-node-env-inline and babel-plugin-transform-inline-environment-variables.
(I'm not sure why there are two methods. This is a side issue, but a point of confusion.)
I'm seeing a problem using either method: code that should be removed as unreachable is left in the source if it contains require.
The .babelrc in use (here with babel-plugin-transform-node-env-inline):
I'm building an app using electron 1.4.13. I'm using babel-preset-env to target babel to the current node release (7.3.0) for transpilation of electron's main process code. (Main process code doesn't need to be bundled into a single file and can use require.)
In the main process code, I want to use NODE_ENV to include/exclude code based on the build target. I see there are two ways to do this: babel-plugin-transform-node-env-inline and babel-plugin-transform-inline-environment-variables.
(I'm not sure why there are two methods. This is a side issue, but a point of confusion.)
I'm seeing a problem using either method: code that should be removed as unreachable is left in the source if it contains
require
.The
.babelrc
in use (here with babel-plugin-transform-node-env-inline):Build method (
ttt
is a temp test directory):NODE_ENV=production babel src/ttt --out-dir out/ttt
Test file
src/ttt/ttt.js
(therequire
d file exists):Since every test is false, with either inlining plugin I expect to see
"use strict"
plus twoconsole.log
calls for "pre" and "post".Actual output (with babel-plugin-transform-node-env-inline), reformatted for readability:
With babel-plugin-transform-inline-environment-variables instead:
Am I doing anything wrong?
The text was updated successfully, but these errors were encountered: