Closed zachsa closed 2 years ago
I replicated this example with:
version = 0.1
extensions = ['chomp@0.1:jspm']
[[task]]
name = 'two'
deps = ['one']
run = 'node index.js'
[[task]]
name = 'one'
template = 'jspm'
dep = 'in.html'
target = 'out.html'
[task.template-options]
env = ['node', 'production', 'module']
But I get undefined
in the log since there is nothing in any of the above that actually sets process.env.NODE_ENV
.
I think you may be confusing env
in JSPM generator and ENV
in Chomp which are completely separate things.
In JSPM generator the development production conditions alter which modules are loaded. If index.js
is relying on an import map itself then some dependency is likely writing process.env.NODE_ENV
.
Yes I was confused (and your task template env is correct). Since jspm wasn't using NODE_ENV I was getting mismatched import versions to my NODE_ENV if the second argument to jspm env didn't match how I was specifying NODE_ENV.
I think the issue with seeing 'production' without specifying a value was because I had previously specified that in my shell
With an
index.js
file:This workflow
The log is 'production'.
If I change task one: env = ['node', 'development', 'module'], then the log is 'development'.
Is this intentional? I was expecting that the 'two' task would have the default env rather than env variables specified for previous tasks. The specific case is that I want to generate 'production' import maps (I think this will get me production builds of all the libraries), but set my NODE_ENV variable to development for the server start