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

less-node.js overwrites NODE_ENV #5

@mikol-styra

Description

@mikol-styra

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/nodelibs-process@0.2.0-alpha/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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions