Home  >  Q&A  >  body text

node.js - webpack官方的例子(webpack --env=dev),env怎么获取不到

PHPzPHPz2720 days ago537

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 16:31:01

    Use NODE_ENV as input parameter and process.env.NODE_ENV as parameter to obtain

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 16:31:01

    The final result may be that it is not possible to write it according to the official method in the windows environment (? Not sure). The solution is to use cross-env to configure NODE_ENV

    npm install cross-env --save-dev
    

    scripts are as follows:

    "build:dev": "cross-env NODE_ENV=dev webpack --progress --profile --colors"

    reply
    0
  • Cancelreply