Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

fix bugs: #727

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions template/.electron-vue/dev-runner.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

process.env.NODE_ENV = 'production'
Copy link
Contributor

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.

Copy link
Contributor Author

@snovey snovey Nov 2, 2018

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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 reads production as string, it works how it should and .eslintrc.js doesn't need changes.
  2. 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:
    "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 cases NODE_ENV is undefined because we start coding from development and then we separate environment for production.
I hope you understand idea


const chalk = require('chalk')
const electron = require('electron')
const path = require('path')
Expand Down
3 changes: 2 additions & 1 deletion template/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = {
'no-multi-assign': 0,
{{/if_eq}}
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
// `process.env.NODE_ENV` will get `undefined` when `npm run lint`
'no-debugger': process.env.NODE_ENV === 'development' ? 0 : 2
}
}