-
-
Notifications
You must be signed in to change notification settings - Fork 372
Closed
Description
I want to include some libraries and use cdn.
Where's index.html?
What should I do?
npm start is no error, but npm run build error:
Template execution failed: ReferenceError: window is not defined
ReferenceError: window is not defined
Template execution failed: ReferenceError: document is not defined
ReferenceError: document is not definedcode 1 (window is not defined):
import Swiper from 'swiper';
// .... Swiper using window object
componentDidMount() {
let { options, swiperIsInitialized } = this.props;
// <div className="swiper-container" ref={r => this.root = r}>
this.swiper = new Swiper(this.root, options);
this.props.swiperIsInitialized(this.swiper);
}code 2 (document is not defined):
import './style';
import App from './components/app';
const head = document.querySelector('html > head');
// add css
head.innerHTML += `
<link href="https://cdn.bootcss.com/material-design-icons/3.0.1/iconfont/material-icons.min.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/Swiper/3.4.2/css/swiper.min.css" rel="stylesheet">
`;
export default App;Metadata
Metadata
Assignees
Labels
No labels