-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Link css in index.html, ReferenceError: window not defined #625
Comments
|
@cloudmu is right, the right way to include it would be importing in The best solution would be to fix Pace so that it can be imported normally without depending on a different Another workaround would be to use it from a CDN, which you can add to
However, it's possible and likely that your app loads faster with the method described above (import) because then the script and styles can be bundled with your app's code and loaded with a single roundtrip to the server. |
I think the author wants to avoid imports and bundling intentionally because the sole reason |
I'd like to keep this open because this is one of use cases we should make sure we have a reasonable way of supporting before 1.0. |
@fson thanks for pointing out |
I would very much hate to lose this! |
I drafted a proposal to solve this in #703. Unless we find some fatal flaws, it should come out in 0.5.0. Let me know what you think! |
@gaearon Great! |
Closing as this is fixed, and will be released in 0.5.0. |
It looks great - can't wait to try it out. |
This is now supported in 0.5.0. Read about using the new See also migration instructions and breaking changes in 0.5.0. |
@gaearon Thanks for release 0.5.0 so quickly. I migrated to 0.5.0, but found a problem. Content in my index.html: <link href="%PUBLIC_URL%/pace/theme/pace-theme-minimal.css" rel="stylesheet" />
<script type="text/javascript">
paceOptions = {ajax: {trackWebSockets: false}};
</script>
<script src="%PUBLIC_URL%/pace/pace.js"></script> It be converted to: <link href="/pace/theme/pace-theme-minimal.css" rel="stylesheet" />
<script type="text/javascript">
paceOptions = {ajax: {trackWebSockets: false}};
</script>
<script src="%PUBLIC_URL%/pace/pace.js"></script> Seems it just replaces the first Below is my
Errors in terminal:
|
Oops, that might be true. Blame this on me not knowing how replace() works in JS :-P. Would you like to send a fix? It's in InterpolateHtmlPlugin.js in packages/react-dev-utils. |
I'm already fixing this :) |
@fson 👍 |
Fixed by #731. |
0.5.1 is out, I just verified this is fixed in it. |
Fixed, thanks. A little problem, I migrated from 0.5.0 to 0.5.1 with below command:
But the version of |
That's weird. I guess not a big deal if new projects reference the correct version (I doubt a lot of people had a chance to catch 0.5.0 before 0.5.1 came out.) Will keep this in mind for the future. |
I used
pace.js
to got a better loading experience, but it can't be linked inindex.html
, some errors raised:Content of index.html:
Pace.js must be loaded quickly, shouldn't
require
it in project's code.A project can reproduce:
https://github.com/cpunion/CRA-window-not-defined
Related commit:
cpunion/CRA-window-not-defined@2ad61c7
The text was updated successfully, but these errors were encountered: