I migrated my project from react boilerplate 3.5.0 to 3.7.0. The boilerplate structure changed a little, and I needed to update some dependencies, but finally webpack compiled with no errors.
But here is the console of my browser:
This is the contents of the global-styles.js
file:
import { injectGlobal } from 'styled-components';
/* eslint no-unused-expressions: 0 */
injectGlobal`
html,
body {
height: 100%;
width: 100%;
}
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
body.fontLoaded {
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
#app {
background-color: #3892d3;
min-height: 100%;
min-width: 100%;
}
p,
label {
font-family: Georgia, Times, 'Times New Roman', serif;
line-height: 1.5em;
}
.row {
margin: 0px;
padding: 0px;
}
.main .container-fluid {
padding: 0px 6px 0px 6px;
margin: 0px ;
height: 100%;
min-width: 440px;
// background: #ffffff;
// height: calc(100% - 5px);
}
.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, .col,
.col-auto, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm,
.col-sm-auto, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-md,
.col-md-auto, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg,
.col-lg-auto, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl,
.col-xl-auto {
position: relative;
width: 100%;
min-height: 1px;
padding-right: 5px;
padding-left: 5px;
}
`;
I tried removing this file and commenting the references to it, but the thing is I have no idea on how to solve this, since it was working fine before the upgrade.
Any clue on how to solve this?
React boilerplate 3.7.0 does not use styled-components
v3 anymore. It was migrated into v4. styled-components
v4 does not use injectGlobal
function anymore. It was replaced with createGlobalStyle
API. The error you receive comes because there's no such thing like injectGlobal
.
As docs say:
const GlobalStyles = createGlobalStyle`
html {
color: 'red';
}
`;
// then put it in your React tree somewhere:
// <GlobalStyles />