Closed jokerslab closed 8 years ago
@jokerslab This should fix that https://github.com/schovi/webpack-chrome-extension/commit/6085389649ea21b28de4e259f75186a1d2a6ea85 Give me report
This almost fixes everything. There was also a problem with the ability to set env variables using npm run-scripts on windows. better-npm-run and cross-env seem to solve that problem. I made a pull request that did basically the same thing and added the cross-env module.
@jokerslab I am not sure if I understand.
I add console.log("XXX", process.env.MY_ENV)
into dev-env/build.js
Then it prints XXX test
correctly when i run MY_ENV=test npm run build
Can you explain it better please?
When I try to run the script on windows it doesn't recognize the ability to set the environment and the command from the package.json file. See: http://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-in-windows And this comment helped me solve the issue: http://stackoverflow.com/questions/25112510/how-to-set-environment-variables-from-within-package-json-node-js#comment57929242_27090755 `$ npm run dev
WebpackChromeExtension@0.3.1 dev C:\repos\webpack-chrome-extension NODE_ENV=development ./node_modules/.bin/babel-node ./dev-env/dev.js
'NODE_ENV' is not recognized as an internal or external command, operable program or batch file.
npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "dev" `
This is working on Ubuntu, issues with Windows!! Cloned / npm install. Can't run.
The file dev-env/util/remove.js has some utility functions for building paths. However it assumes the directory separator is a "/", when on windows it is a "\".
I think it can use something like path.sep