npm WARN loadable-components@0.2.1 requires a peer of react@^15.0.0 but none is installed. You must install peer dependencies yourself.
audited 17975 packages in 14.846s
found 216 high severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
front-end@0.0.1 ssr:prod:main /usr/src/app
NODE_ICU_DATA=node_modules/full-icu BUILD_MODE=MAIN NODE_ENV=production babel-node index.js
/usr/src/app/node_modules/@babel/core/lib/config/config-descriptors.js:205
throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`].join("\n"));
^
Error: Duplicate plugin/preset detected.
If you'd like to use two separate instances of a plugin,
they need separate names, e.g.
plugins: [
['some-plugin', {}],
['some-plugin', {}, 'some unique name'],
]
at assertNoDuplicates (/usr/src/app/node_modules/@babel/core/lib/config/config-descriptors.js:205:13)
at createDescriptors (/usr/src/app/node_modules/@babel/core/lib/config/config-descriptors.js:114:3)
at createPluginDescriptors (/usr/src/app/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
at plugins (/usr/src/app/node_modules/@babel/core/lib/config/config-descriptors.js:40:19)
at mergeChainOpts (/usr/src/app/node_modules/@babel/core/lib/config/config-chain.js:319:26)
at /usr/src/app/node_modules/@babel/core/lib/config/config-chain.js:283:7
at buildRootChain (/usr/src/app/node_modules/@babel/core/lib/config/config-chain.js:120:22)
at loadPrivatePartialConfig (/usr/src/app/node_modules/@babel/core/lib/config/partial.js:85:55)
at loadFullConfig (/usr/src/app/node_modules/@babel/core/lib/config/full.js:43:39)
at loadOptions (/usr/src/app/node_modules/@babel/core/lib/config/index.js:27:36)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! front-end@0.0.1 ssr:prod:main: `NODE_ICU_DATA=node_modules/full-icu BUILD_MODE=MAIN NODE_ENV=production babel-node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the front-end@0.0.1 ssr:prod:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
<object id="SVG" data="cdn link" type="image/svg+xml"></object>
<script>
window.onload=function() {
var object = document.getElementById("SVG");
var svgDocument = object.contentDocument;
console.log(svgDocument);
// var svgb1 = svgDocument.getElementsByClassName("firstb");
// var svgb2 = svgDocument.getElementsByClassName("secondb");
// svgb1[0].setAttribute("fill", "yellow");
// svgb2[0].setAttribute("fill", "red");
};
</script>
class ComponentsWrap extends Component {
constructor(props) {
super(props);
this.state = {
pageLoad: false
}
}
componentDidMount() {
this.props.infoPage(this.props.match.params.param);
}
componentDidUpdate(prevProps, prevState, snapshot) {
if (this.props.pageInfo && this.props.pageInfo !== prevProps.pageInfo) {
this.setState({
pageLoad: true
})
}
}
getComonent(type) {
switch (type) {
case 'component1':
return <Component1 history={this.props.history} />;
case 'component2':
return <Component2 history={this.props.history} />;
case 'component3':
return <Component3 history={this.props.history} />;
default:
return <Page404 />;
}
}
render() {
if (!this.state.pageLoad) {
console.log('Preload');
return <p>Preload</p>
}
console.log('Получено render', this.state.pageLoad);
const Component = this.getComonent(this.props.pageInfo.type);
console.log(Component);
return Component;
}
}
export default withRouter(connect(
state => ({
pageInfo: state.pageInfo
}),
dispatch => () => {
return {
infoPage: (page) => dispatch(pageInfo(page)),
}
}
)(ComponentsWrap))
let { pageInfo } = this.props;
let resultComponent = null;
if (pageInfo.type === 'component1') {
resultComponent = <Component1/>;
} else if (pageInfo.type === 'component2') {
resultComponent = <Component2 />;
} else if (pageInfo.type === 'component3') {
resultComponent = <Component3 />;
} else {
resultComponent = <Page404 />;
}
return resultComponent;
devServer: {
historyApiFallback: {
disableDotRule: true
}