Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = {
- devServer: {
- historyApiFallback: true
- },
- entry: {
- app:"./src/index.js",
- vendor: [
- "axios",
- "react",
- "react-dom",
- "react-redux",
- "react-router",
- "react-router-dom",
- "redux"
- ]
- },
- output: {
- path: __dirname + '/public/views',
- filename: '[name].js',
- chunkFilename: '[chunkhash].chunk.js',
- publicPath: "/views/"
- },
- module: {
- loaders: [
- {
- test: /.js$/,
- loader: "babel-loader",
- exclude: [/node_modules/, /pdfmake.js$/]
- },
- {
- test: /.json$/,
- loader: "json-loader"
- }
- ]
- },
- plugins: [
- new webpack.optimize.CommonsChunkPlugin({
- name: "vendor",
- minChunks: Infinity
- }),
- new webpack.NamedModulesPlugin(),
- new HtmlWebpackPlugin({
- filename: __dirname + "/views/index.ejs",
- template: __dirname + "/views/template.ejs",
- inject: 'body',
- chunks: ['vendor', 'app'],
- chunksSortMode: 'manual'
- }),
- new PreloadWebpackPlugin({
- rel: "preload",
- include: ["vendor", "app"]
- }),
- new webpack.optimize.OccurrenceOrderPlugin(),
- ]
- };
- import React from "react";
- import ReactDOM from "react-dom";
- import { Provider } from "react-redux";
- import { createStore, applyMiddleware } from "redux";
- import { BrowserRouter, Route, Switch } from "react-router-dom";
- import promise from "redux-promise";
- import reducers from "./reducers";
- import AppInit from "./containers/appInit";
- import ProfRegisteringModal from "./containers/modals/register_prof_explanation_modal";
- const createStoreWithMiddleware = applyMiddleware(promise)(createStore);
- function errorLoading(err) {
- console.error("Dynamic page loading failed", err);
- }
- function loadRoute(cb) {
- return module => cb(null, module.default);
- }
- console.log("testst");
- ReactDOM.render(
- <Provider store={createStoreWithMiddleware(reducers)}>
- <AppInit>
- <BrowserRouter>
- <div style={{ height: "100%" }}>
- <ProfRegisteringModal />
- <Switch>
- <Route
- path="/inscription/:user"
- getComponent={(location, callback) => {
- import(
- "./components/registering/registering_landing_page.js"
- )
- .then(loadRoute(cb))
- .catch(errorLoading);
- }}
- />
- <Route
- path="/inscription"
- getComponent={(location, callback) => {
- import(
- "./components/registering/registering_landing_page.js"
- )
- .then(loadRoute(cb))
- .catch(errorLoading);
- }}
- />
- <Route
- path="/connexion"
- getComponent={(location, callback) => {
- import("./containers/registering/signing_in.js")
- .then(loadRoute(cb))
- .catch(errorLoading);
- }}
- />
- <Route
- path="/equipe"
- getComponent={(location, callback) => {
- import("./components/team_pres.js")
- .then(loadRoute(cb))
- .catch(errorLoading);
- }}
- />
- <Route
- path="/"
- getComponent={(location, callback) => {
- import("./containers/app_container.js")
- .then(loadRoute(cb))
- .catch(errorLoading);
- }}
- />
- </Switch>
- </div>
- </BrowserRouter>
- </AppInit>
- </Provider>,
- document.querySelector(".root")
- );
Add Comment
Please, Sign In to add comment