Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process.env properties are undefined when used with modes #9

Closed
autumnwoodberry opened this issue Nov 26, 2018 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@autumnwoodberry
Copy link

Adding the VUE_CLI_KEEP_TEST_ATTRS to a .env.mode file and loading it with --mode mode does not work. The process.env.VUE_CLI_KEEP_TEST_ATTRS and process.env.NODE_ENV are undefined.

Moving the check into the main function solves this issue but I'm not sure if there are any other consequences from doing that - seems like it should be fine though.

Adding the variable directly (using VUE_CLI_KEEP_TEST_ATTRS=true vue-cli-service build for example) work just fine.

@LinusBorg
Copy link
Owner

Hey @autumnwoodberry,

only saw this now, apologies.

The process.env.VUE_CLI_KEEP_TEST_ATTRS and process.env.NODE_ENV are undefined.

Where are they undefined?

@autumnwoodberry
Copy link
Author

autumnwoodberry commented Feb 5, 2019

@LinusBorg

If you create a .env.e2e file with VUE_CLI_KEEP_TEST_ATTRS=true then it will never set defaultOptions.enabled = false and the test attributes will be stripped in your e2e environment because at this point https://github.com/LinusBorg/vue-cli-plugin-test-attrs/blob/develop/index.js#L13-L19 both the process.env.VUE_CLI_KEEP_TEST_ATTRS and process.env.NODE_ENV are undefined.

As I mentioned before, if you do VUE_CLI_KEEP_TEST_ATTRS=true vue-cli-service build it works fine.

@LinusBorg
Copy link
Owner

Right, I have to move those into the plugin function. Thanks!

@LinusBorg LinusBorg added the bug Something isn't working label Feb 11, 2019
LinusBorg added a commit that referenced this issue Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants