0

ただし、私が知る限り、インストールすらしていません。以前はそうだったと思いますが、現在、このプロジェクトを webpack4x と babel 7x に更新中です。webpack 3x と babel 6x でした。

これが私のpackage.jsonです

"dependencies": {
    "@appbaseio/reactivesearch": "^3.0.0-rc.6",
    "axios": "0.16.2",
    "compression": "^1.7.4",
    "concurrently": "3.5.0",
    "express": "4.16.4",
    "express-http-proxy": "1.0.6",
    "lodash": "^4.17.11",
    "nodemon": "^1.18.11",
    "npm-run-all": "4.1.1",
    "react": "16.0.0",
    "react-cookie": "^3.1.2",
    "react-dom": "16.0.0",
    "react-helmet": "5.2.0",
    "react-redux": "5.0.6",
    "react-router-config": "^5.0.0",
    "react-router-dom": "4.2.2",
    "redux": "3.7.2",
    "redux-thunk": "2.2.0",
    "serialize-javascript": "1.4.0"
  },
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.4.4",
    "@babel/preset-env": "^7.4.4",
    "@babel/preset-react": "^7.0.0",
    "@babel/register": "^7.4.4",
    "babel-loader": "^8.0.5",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "webpack": "^4.29.3",
    "webpack-cli": "^3.2.3",
    "webpack-dev-server": "^3.3.1",
    "webpack-merge": "^4.2.1",
    "webpack-node-externals": "^1.7.2"
  }
}

これは React-SSR プロジェクトの一部です。これが私のclient.jsです(クライアントアプリの始まり)

// Startup point for the client side application
// ref: https://babeljs.io/docs/en/next/babel-polyfill.html
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import { Provider } from 'react-redux';
import { renderRoutes } from 'react-router-config';
import axios from 'axios';
import Routes from './Routes';
import reducers from './reducers';

const axiosInstance = axios.create({
    baseURL: '/api'
});

// this is the client side store - there is also a server side store in /helpers/createStore.js
const store = createStore(
    reducers,
    window.INITIAL_STATE,
    applyMiddleware(thunk.withExtraArgument(axiosInstance))
);

ReactDOM.hydrate(
    <Provider store={store}>
        <BrowserRouter>
            <div>{renderRoutes(Routes)}</div>
        </BrowserRouter>
    </Provider>,
    document.querySelector('#root')
);

これが私の.babelrcです

{
    "plugins": ["transform-object-rest-spread"],
    "presets": [
        "@babel/preset-react",
        "@babel/preset-env"
    ]
}

必要なパッケージが不足しているのか、それとも設定が間違っているのかよくわかりません...?

4

1 に答える 1