From b030235bbc340bdc42df2c2876c40620e0e749a9 Mon Sep 17 00:00:00 2001 From: Sean Landsman Date: Tue, 7 Nov 2017 16:32:03 +0000 Subject: [PATCH] AG-530 Implement React declarative offering --- package.json | 2 +- index.html => src-large/index.html | 2 +- src-large/index.js | 6 +++--- src-trader-dashboard/index.js | 4 ++-- webpack.config.large.js | 18 +++++++++++++----- webpack.config.trader.js | 4 +++- 6 files changed, 23 insertions(+), 13 deletions(-) rename index.html => src-large/index.html (97%) diff --git a/package.json b/package.json index 14422f5..cb46083 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "trader": "webpack-dev-server --content-base src-trader-dashboard/ --config webpack.config.trader.js --progress --colors --hot --inline", "examples": "webpack-dev-server --content-base src/ --config webpack.config.examples.js --progress --colors --hot --inline", - "large": "webpack-dev-server --config webpack.config.large.js --progress --colors --hot --inline", + "large": "webpack-dev-server --content-base src-large/ --config webpack.config.large.js --progress --colors --hot --inline", "clean": "rimraf dist", "mkdirs": "mkdirp dist/trader/dist dist/examples/dist", "copy-examples": "ncp images dist/examples/images && ncp src/index.html dist/examples/index.html && ncp dist/react-examples.js dist/examples/dist/react-examples.js && ncp src dist/examples/src", diff --git a/index.html b/src-large/index.html similarity index 97% rename from index.html rename to src-large/index.html index de8ea1e..d61f4fd 100644 --- a/index.html +++ b/src-large/index.html @@ -5,7 +5,7 @@ - + diff --git a/src-large/index.js b/src-large/index.js index 931f4f8..4e03d5c 100644 --- a/src-large/index.js +++ b/src-large/index.js @@ -3,9 +3,9 @@ import ReactDOM from 'react-dom'; import React from 'react'; import LargeGrid from './largeGrid.jsx'; -// is there a better way of doing this? -import 'ag-grid-root/dist/styles/ag-grid.css'; -import 'ag-grid-root/dist/styles/theme-fresh.css'; + +import 'ag-grid/dist/styles/ag-grid.css'; +import 'ag-grid/dist/styles/theme-fresh.css'; // waiting for dom to load before booting react. we could alternatively // put the index.js reference at the end fo the index.html, but i prefer this way. diff --git a/src-trader-dashboard/index.js b/src-trader-dashboard/index.js index 77198e5..46ab471 100644 --- a/src-trader-dashboard/index.js +++ b/src-trader-dashboard/index.js @@ -5,8 +5,8 @@ import {render} from "react-dom"; import {Provider} from "react-redux"; -import "ag-grid-root/dist/styles/ag-grid.css"; -import "ag-grid-root/dist/styles/theme-fresh.css"; +import "ag-grid/dist/styles/ag-grid.css"; +import "ag-grid/dist/styles/theme-fresh.css"; import StoreService from './services/StoreService'; import TraderDashboard from "./components/TraderDashboard.jsx"; diff --git a/webpack.config.large.js b/webpack.config.large.js index a4e1475..4a7a41e 100644 --- a/webpack.config.large.js +++ b/webpack.config.large.js @@ -1,8 +1,12 @@ +const path = require('path'); + +const SRC_DIR = path.resolve(__dirname, 'src-large'); + module.exports = { - entry: "./src-large/index.js", + entry: SRC_DIR + "/index.js", output: { path: __dirname, - filename: "dist/bundle.js" + filename: "dist/react-large.js" }, module: { loaders: [ @@ -12,16 +16,20 @@ module.exports = { }, { test: /\.js$|\.jsx$/, + include: SRC_DIR, loader: 'babel-loader', query: { - presets: ['react', 'es2015'] + presets: ['react', 'es2015', 'stage-0'] } } ] }, resolve: { alias: { - "ag-grid-root" : __dirname + "/node_modules/ag-grid" - } + "ag-grid": path.resolve('./node_modules/ag-grid'), + "ag-grid-enterprise": path.resolve('./node_modules/ag-grid-enterprise'), + react: path.resolve('./node_modules/react') + }, + extensions: ['', '.js', '.jsx'] } }; \ No newline at end of file diff --git a/webpack.config.trader.js b/webpack.config.trader.js index 46b3aae..386ab66 100644 --- a/webpack.config.trader.js +++ b/webpack.config.trader.js @@ -26,7 +26,9 @@ module.exports = { }, resolve: { alias: { - "ag-grid-root" : __dirname + "/node_modules/ag-grid" + "ag-grid": path.resolve('./node_modules/ag-grid'), + "ag-grid-enterprise": path.resolve('./node_modules/ag-grid-enterprise'), + react: path.resolve('./node_modules/react') }, extensions: ['', '.js', '.jsx'] }