admin管理员组文章数量:1023081
Can someone explain why I must embed the double quotes within single quotes in my Webpack configuration below? Why does it not work to just use double quotes?
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
API: '"http://localhost:8080"'
});
My app fails to load if I remove the single quotes, which seems really odd.
Can someone explain why I must embed the double quotes within single quotes in my Webpack configuration below? Why does it not work to just use double quotes?
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
API: '"http://localhost:8080"'
});
My app fails to load if I remove the single quotes, which seems really odd.
Share Improve this question edited Jun 6, 2017 at 6:19 Andrew Li 58k14 gold badges134 silver badges148 bronze badges asked Jun 6, 2017 at 6:10 blindsnowmobileblindsnowmobile 4,3387 gold badges38 silver badges51 bronze badges1 Answer
Reset to default 8This webpack plugin is going to be doing interpolation in your code. In other words, it will be replacing, at build time, process.env.NODE_ENV
with whatever you have there.
So your code goes from console.log(process.env.NODE_ENV)
to console.log("development")
. If you left out the single quotes it would bee console.log(development)
, which would fail since there is no variable development
.
Can someone explain why I must embed the double quotes within single quotes in my Webpack configuration below? Why does it not work to just use double quotes?
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
API: '"http://localhost:8080"'
});
My app fails to load if I remove the single quotes, which seems really odd.
Can someone explain why I must embed the double quotes within single quotes in my Webpack configuration below? Why does it not work to just use double quotes?
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
API: '"http://localhost:8080"'
});
My app fails to load if I remove the single quotes, which seems really odd.
Share Improve this question edited Jun 6, 2017 at 6:19 Andrew Li 58k14 gold badges134 silver badges148 bronze badges asked Jun 6, 2017 at 6:10 blindsnowmobileblindsnowmobile 4,3387 gold badges38 silver badges51 bronze badges1 Answer
Reset to default 8This webpack plugin is going to be doing interpolation in your code. In other words, it will be replacing, at build time, process.env.NODE_ENV
with whatever you have there.
So your code goes from console.log(process.env.NODE_ENV)
to console.log("development")
. If you left out the single quotes it would bee console.log(development)
, which would fail since there is no variable development
.
本文标签: npmWhy do I have to have double quotes inside single quotes in JavaScriptStack Overflow
版权声明:本文标题:npm - Why do I have to have double quotes inside single quotes in JavaScript? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745526739a2154559.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论