-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Make all vars accessiable in index.html #1440
Changes from 2 commits
6e378d4
f87873e
5763d44
7c948a3
0e5fcdc
096f3c6
c41e81b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,9 +205,7 @@ module.exports = { | |
// Makes the public URL available as %PUBLIC_URL% in index.html, e.g.: | ||
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> | ||
// In development, this will be an empty string. | ||
new InterpolateHtmlPlugin({ | ||
PUBLIC_URL: publicUrl | ||
}), | ||
new InterpolateHtmlPlugin(env), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please update the comment to reflect the new behavior? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 5763d44 |
||
// Generates an `index.html` file with the <script> injected. | ||
new HtmlWebpackPlugin({ | ||
inject: true, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,9 +218,7 @@ module.exports = { | |
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> | ||
// In production, it will be an empty string unless you specify "homepage" | ||
// in `package.json`, in which case it will be the pathname of that URL. | ||
new InterpolateHtmlPlugin({ | ||
PUBLIC_URL: publicUrl | ||
}), | ||
new InterpolateHtmlPlugin(env), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 5763d44 |
||
// Generates an `index.html` file with the <script> injected. | ||
new HtmlWebpackPlugin({ | ||
inject: true, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you stringify in a second step now? Seems like unnecessary complication to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @gaearon explanation, We need to stringify values into strings such that we could use
process.env.X
in js code.I have changed some code for more explicitly.