mirror of
https://github.com/strapi/strapi.git
synced 2025-12-11 06:53:12 +00:00
Use React and React-DOM through global to use the exact same dependency everywhere
This commit is contained in:
parent
a67229496e
commit
b8accc03b9
@ -7,8 +7,6 @@
|
||||
import 'babel-polyfill';
|
||||
|
||||
// Import all the third party stuff
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Provider } from 'react-redux';
|
||||
import { ConnectedRouter } from 'react-router-redux';
|
||||
import createHistory from 'history/createBrowserHistory';
|
||||
@ -121,7 +119,6 @@ window.Strapi = {
|
||||
apiUrl,
|
||||
refresh: (pluginId) => ({
|
||||
translationMessages: (translationMessagesUpdated) => {
|
||||
console.log(translationMessagesUpdated);
|
||||
render(merge({}, translationMessages, translationMessagesUpdated));
|
||||
},
|
||||
leftMenuSections: (leftMenuSectionsUpdated) => {
|
||||
|
||||
@ -4,8 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
class Header extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { defineMessages, FormattedMessage } from 'react-intl';
|
||||
|
||||
import LocaleToggle from 'containers/LocaleToggle';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { map } from 'lodash';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ReactCSSTransitionGroup from 'react/lib/ReactCSSTransitionGroup';
|
||||
import Notification from 'components/Notification';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import ToggleOption from 'components/ToggleOption';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { injectIntl, intlShape } from 'react-intl';
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
* the linting exception.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
* the linting exception.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Switch, Route } from 'react-router-dom';
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import Helmet from 'react-helmet';
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import Helmet from 'react-helmet';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
* IntlProvider component and i18n messages (loaded from `app/translations`)
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
* the linting exception.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { defineMessages, FormattedMessage } from 'react-intl';
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
* PluginPage
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import Helmet from 'react-helmet';
|
||||
|
||||
@ -12,5 +12,7 @@
|
||||
<!-- The app hooks into this div -->
|
||||
<div id="app"></div>
|
||||
<!-- A lot of magic happens in this file. HtmlWebpackPlugin automatically includes all assets (e.g. bundle.js, main.css) with the correct HTML tags, which is why they are missing in this HTML file. Don't add any assets here! (Check out webpackconfig.js if you want to know more) -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-with-addons.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^5.0.5",
|
||||
"eslint": "^4.7.1",
|
||||
"eslint": "^4.7.2",
|
||||
"eslint-config-airbnb": "^15.1.0",
|
||||
"eslint-config-airbnb-base": "^11.3.2",
|
||||
"eslint-config-prettier": "^2.5.0",
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
"no-use-before-define": 0,
|
||||
"prefer-template": 2,
|
||||
"class-methods-use-this": 0,
|
||||
"react/react-in-jsx-scope": 0,
|
||||
"react/forbid-prop-types": 0,
|
||||
"react/jsx-first-prop-new-line": [
|
||||
2,
|
||||
|
||||
@ -16,8 +16,13 @@ module.exports = (options) => ({
|
||||
publicPath: '/',
|
||||
}, options.output), // Merge with env dependent settings
|
||||
module: {
|
||||
// Comment
|
||||
noParse: [
|
||||
/\/react\//g,
|
||||
/\/react-dom\//g,
|
||||
],
|
||||
loaders: [{
|
||||
test: /\.js$/, // Transform all .js files required somewhere with Babel
|
||||
test: /\.js$/, // Transform all .js files required somewhere with Babel,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
@ -140,6 +145,8 @@ module.exports = (options) => ({
|
||||
],
|
||||
alias: {
|
||||
moment: 'moment/moment.js',
|
||||
'react': 'React',
|
||||
'react-dom': 'React-DOM',
|
||||
},
|
||||
symlinks: false,
|
||||
extensions: [
|
||||
@ -153,7 +160,7 @@ module.exports = (options) => ({
|
||||
'main',
|
||||
],
|
||||
},
|
||||
|
||||
externals: generateExternals(),
|
||||
resolveLoader: {
|
||||
modules: [
|
||||
path.join(__dirname, '..', '..', '..', 'node_modules'),
|
||||
@ -163,3 +170,10 @@ module.exports = (options) => ({
|
||||
devtool: options.devtool,
|
||||
target: 'web', // Make web variables accessible to webpack, e.g. window
|
||||
});
|
||||
|
||||
function generateExternals() {
|
||||
return {
|
||||
'react': 'React',
|
||||
'react-dom': 'ReactDOM',
|
||||
};
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
* only setup and plugin code.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
|
||||
import App, { bootstrap } from 'containers/App'; // eslint-disable-line
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import styles from './styles.scss';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import PropTypes from 'prop-types';
|
||||
import { get, isEmpty, map, mapKeys, isObject, reject, includes } from 'lodash';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import PluginHeaderTitle from 'components/PluginHeaderTitle';
|
||||
import PluginHeaderActions from 'components/PluginHeaderActions';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import Button from 'components/Button';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
// modal
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
class Container extends React.Component {
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
// Dependencies.
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { findIndex, get, omit, isFunction, merge } from 'lodash';
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { map } from 'lodash';
|
||||
|
||||
@ -15,7 +14,7 @@ import styles from './styles.scss';
|
||||
class EditFormRelations extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||
render() {
|
||||
const relations = map(this.props.schema[this.props.currentModelName].relations, (relation, i) => {
|
||||
|
||||
|
||||
switch (relation.nature) {
|
||||
case 'oneToOne':
|
||||
case 'oneToMany':
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { map } from 'lodash';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { map } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import Select from 'react-select';
|
||||
import PropTypes from 'prop-types';
|
||||
import 'react-select/dist/react-select.css';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import Select from 'react-select';
|
||||
import PropTypes from 'prop-types';
|
||||
import 'react-select/dist/react-select.css';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import TableHeader from '../TableHeader';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import LimitSelect from '../LimitSelect';
|
||||
@ -22,7 +21,7 @@ class TableFooter extends React.Component {
|
||||
limit={this.props.limit}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="col-lg-6">
|
||||
<Pagination
|
||||
limit={this.props.limit}
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { isEmpty } from 'lodash';
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators, compose } from 'redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
// Dependencies.
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators, compose } from 'redux';
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
* Home
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators, compose } from 'redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
* the linting exception.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
export default class NotFound extends React.Component {
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
"prebuild": "npm run build:clean && npm run test",
|
||||
"build": "cross-env NODE_ENV=production webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:clean": "rimraf admin/build",
|
||||
"start": "cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/lib/server",
|
||||
"start": "cross-env NODE_ENV=development PLUGIN=true node node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "eslint --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"pretest": "npm run lint",
|
||||
@ -49,7 +49,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^5.0.5",
|
||||
"eslint": "^4.7.1",
|
||||
"eslint": "^4.7.2",
|
||||
"eslint-config-airbnb": "^15.1.0",
|
||||
"eslint-config-airbnb-base": "^11.3.2",
|
||||
"eslint-config-prettier": "^2.5.0",
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^5.0.5",
|
||||
"eslint": "^4.7.1",
|
||||
"eslint": "^4.7.2",
|
||||
"eslint-config-airbnb": "^15.1.0",
|
||||
"eslint-config-airbnb-base": "^11.3.2",
|
||||
"eslint-config-prettier": "^2.5.0",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user