我在Win10上,如你所知,路径很乱。我不想使用反斜杠,因为这会使它太特定于os。我想使用“path”,但我不能在导入之前使用它。
import React from 'react';
import Prismic from 'prismic-javascript';
const apiEndpoint = 'https://project.prismic.io/api/v2';
const apiToken = 'TOKEN';
export default class Index extends React.Component {
static async getInitialProps({ req, query }) {
const data = await Prismic.getApi(apiEndpoint, { accessToken: apiToken })
.then(api => {
return api.query(''); // An empty query will return all the documents
})
.catch(err => console.log(err));
return { cars: data.results };
}
render() {
return <div>Example car id: {this.props.cars[0].id}</div>;
}
}
我如何import React from 'react';
import ReactDOM from 'react-dom';
var path = require("path");
var bootstrapCSS = path.normalize('./src/assets/bootstrap/css/bootstrap.min.css');
var fontCSS = path.normalize('./src/assets/font-awesome/css/font-awesome.min.css');
var seguiCSS = path.normalize('./src/assets/segui-info.css');
import bootstrapCSS
import fontCSS
import seguiCSS
规范化路径?