When restarting with different env variables, packages should be rebuilt.
The current behaviour
When starting with differnt env variables, packages are not rebuilt, forcing me to run meteor reset which in turn also empties the database.
Reproduction:
create a package
add a console.log in package.js that outputs your process.env.
run your app
it outputs your current process.env
stop the app, start with different env variable
it wont output because the code is not reached, because the package is not rebuilt
Why
In order to create packages, which support both, static and dynamic import I am using environment variables as I think this is the only way to control this kind of configurability. For example:
Package.onUse(function (api) {
api.use('ecmascript')
if (!process.env.USE_DYNAMIC_IMPORTS) {
api.addFiles([
// ... all files are added here
]);
} else {
api.use('dynamic-import');
api.mainModule('my-package.js');
}
})
If a user accidentally forgets to set the variable and restarts the app with the correct environment variables then the package is not rebuilt and "keeps" the last configured state.
I am not sure if it's feasible to rebuild all packages based on a changed (hashed) env or if it's possible to implement something like api.getEnv('USE_DYNAMIC_IMPORTS') that keeps track of the env variable to rebuld only dependant packages, but I'd like to bring this to discussion.
Meteor release: 1.11.1
The expected behavior
When restarting with different env variables, packages should be rebuilt.
The current behaviour
When starting with differnt env variables, packages are not rebuilt, forcing me to run
meteor reset
which in turn also empties the database.Reproduction:
package.js
that outputs yourprocess.env
.Why
In order to create packages, which support both, static and dynamic import I am using environment variables as I think this is the only way to control this kind of configurability. For example:
If a user accidentally forgets to set the variable and restarts the app with the correct environment variables then the package is not rebuilt and "keeps" the last configured state.
I am not sure if it's feasible to rebuild all packages based on a changed (hashed) env or if it's possible to implement something like
api.getEnv('USE_DYNAMIC_IMPORTS')
that keeps track of the env variable to rebuld only dependant packages, but I'd like to bring this to discussion.