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

Does not replace environment variable if target is electron #2182

Closed
garrydzeng opened this issue Oct 22, 2018 · 3 comments
Closed

Does not replace environment variable if target is electron #2182

garrydzeng opened this issue Oct 22, 2018 · 3 comments

Comments

@garrydzeng
Copy link

❔ Question

I try to build (command is parcel build index.js --target electron) a script, but Parcel does not replace environment variable, is it feature or bug?

πŸ’» Code Sample

original code

console.log(process.env.REPLACEMENT)

output

process.env.HMR_PORT=0;process.env.HMR_HOSTNAME="localhost";parcelRequire=function(e,r,n,t){var i="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function u(n,t){if(!r[n]){if(!e[n]){var f="function"==typeof parcelRequire&&parcelRequire;if(!t&&f)return f(n,!0);if(i)return i(n,!0);if(o&&"string"==typeof n)return o(n);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[n][1][r]||r},p.cache={};var l=r[n]=new u.Module(n);e[n][0].call(l.exports,p,l,l.exports,this)}return r[n].exports;function p(e){return u(p.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=r,u.parent=i,u.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]};for(var f=0;f<n.length;f++)u(n[f]);if(n.length){var c=u(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):t&&(this[t]=c)}return u}({"Focm":[function(require,module,exports) {
console.log(process.env.REPLACEMENT);
},{}]},{},["Focm"], null)
//# sourceMappingURL=/index.map

🌍 Your Environment

Software Version(s)
Parcel 1.10.13
Node 8.9.3
npm/Yarn Yarn
Operating System Windows
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label Jan 17, 2020
@github-actions github-actions bot closed this as completed Feb 2, 2020
@goshander
Copy link

Same problem, please help

@github-actions github-actions bot removed the Stale Inactive issues label Feb 9, 2020
@tysoeh
Copy link

tysoeh commented Mar 30, 2020

@Dynan7 I wrote a plugin to address this issue: parcel-plugin-electron-dotenv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants