- Notifications
You must be signed in to change notification settings - Fork1.5k
fix bugs:#727
base:master
Are you sure you want to change the base?
fix bugs:#727
Uh oh!
There was an error while loading.Please reload this page.
Conversation
template/.electron-vue/dev-runner.js Outdated
@@ -1,5 +1,7 @@ | |||
'use strict' | |||
process.env.NODE_ENV='production' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think it's right way to fix this bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
So stupid mistake!
Thank you for reminding me. I have fixed it. Is this the desired result now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
process.env.NODE_ENV
is undefined in.eslintrc.js
in development mode, because we are not passing string while linter runs, but for production it readsproduction
as string, it works how it should and.eslintrc.js
doesn't need changes.- Highlighted third line in your code, I think is wrong way to pass data for NODE_ENV, you can do it same way as we did for production:
electron-vue/template/package.json
Line 34 in8fae476
"pack:renderer":"cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
right example:cross-env NODE_ENV=development webpack --progress --colors --config .electron-vue/webpack.renderer.config.js
Conclusion:debugger
for development environment already works fine and currently we have only two mode for NODE_ENV:development
&production
, in most casesNODE_ENV
isundefined
because we start coding from development and then we separate environment for production.
I hope you understand idea
sorry for my careless
Uh oh!
There was an error while loading.Please reload this page.
The value of
process.env.NODE_ENV
is never set todevelopment
in the project.Only run
npm run build
will get correct value ofprocess.env.NODE_ENV
, other command will getundefined
.I want to lint
no-debugger
when runnpm run lint
ornpm run build
but not lintno-debugger
when runnpm run dev
.(EsLint is going to read the.eslintrc.js
file very early on, so to set the value ofprocess.env.NODE_ENV
before that, set the value indev-runner
file).Sorry for my poor English...