Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

less-node.js overwrites NODE_ENV #5

Open
mikol-styra opened this issue Oct 12, 2016 · 1 comment
Open

less-node.js overwrites NODE_ENV #5

mikol-styra opened this issue Oct 12, 2016 · 1 comment

Comments

@mikol-styra
Copy link

In the following code from less-node.js, the line pEnv.NODE_ENV = productionEnv ? 'production' : 'development'; overwrites the actual environment such that commands like jspm run ... do not behave as expected. If the module being run imports plugin-less at any point, then NODE_ENV will always be 'production'.

$__System.registerDynamic("@system-env", [], false, function() {
  return {
    "production": true,
    "browser": false,
    "node": true,
    "dev": false,
    "default": true
  };
});

$__System.registerDynamic("github:jspm/[email protected]/process-node.js", ["@system-env", "@node/process"], true, function($__require, exports, module) {
  ;
  var define,
      global = this,
      GLOBAL = this;
  var productionEnv = $__require('@system-env').production;
  var process = $__require('@node/process');
  var pEnv = process.env;
  pEnv.NODE_ENV = productionEnv ? 'production' : 'development';
  module.exports = process;
  return module.exports;
});

I discovered this while working through a separate issue with server-side rendering when plugin-less (via css-plugin-base) attempts to inject into the DOM but document is not defined (of course).

@guybedford
Copy link
Member

I've added an adjustment to jspm 0.17 here in jspm/jspm-cli@78da833.

That should hopefully make this work out for your use case I think.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants