-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack #1
base: main
Are you sure you want to change the base?
Webpack #1
Changes from 9 commits
0b38263
c347f0c
c9e2363
af20418
939a8e9
9f511b4
deb6070
60980e6
c5747cd
b6d7fd2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"presets": ["@babel/preset-react", "@babel/preset-env"], | ||
"plugins": [ | ||
"@babel/proposal-object-rest-spread", | ||
"@babel/plugin-syntax-dynamic-import", | ||
"@babel/proposal-class-properties" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# NCrunch | ||
*ncrunch* | ||
*NCrunch* | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# dotnet | ||
bin/ | ||
obj/ | ||
.vs/ | ||
*.user | ||
*.csproj.DotSettings | ||
|
||
project.lock.json | ||
config.json | ||
|
||
# tests | ||
TestResult.xml | ||
|
||
# ncrunch | ||
*.ncrunchsolution | ||
*.ncrunchsolution.user | ||
|
||
# nuget | ||
packages/ | ||
|
||
# ef helpers | ||
int-update.sh | ||
sys-update.sh | ||
prod-update.sh | ||
|
||
src/Service.Host/client/build/ | ||
|
||
src/Service.Host/.local-chromium* | ||
|
||
config.env | ||
local-update.sh | ||
|
||
.vscode/ | ||
|
||
# StyleCop caches | ||
*StyleCop.Cache | ||
|
||
#webpack builds | ||
wwwroot/dist/* | ||
build/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
function Sample({name}) { | ||
var React = require('react'); | ||
|
||
|
||
export default function Sample({name}) { | ||
return <div> | ||
<h1>Hello {name} I am a react component that was rendered on the server :)</h1> | ||
</div>; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ReactDOMServer from 'react-dom/server'; | ||
|
||
import Sample from './Sample.jsx'; | ||
|
||
global.Components = { Sample }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
@{ | ||
Layout = null; | ||
| ||
@model ServerSideReactComponents.Person | ||
|
||
@using React.AspNet | ||
|
||
@{ | ||
Layout = "_Layout"; | ||
|
||
} | ||
@model Person | ||
|
||
<html> | ||
<head> | ||
<title>Hello React</title> | ||
</head> | ||
<body> | ||
@Html.React("Sample", new | ||
{ | ||
name = Model.Name | ||
}) | ||
</body> | ||
</html> | ||
@Html.React("Components.Sample", new { name = Model.Name }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you specify which component to render in the routes corresponding view. This is the index view corresponding to the index route above, and just renders a simple sample componenet with props dervied from the model (Person.cs) |
||
@{ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@using React.AspNet | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
</head> | ||
<body> | ||
@RenderBody() | ||
@Html.ReactGetScriptPaths() | ||
@Html.ReactInitJavaScript() | ||
</body> | ||
</html> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file is just for the dev server build. |
||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>webpack dev server</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
</body> | ||
|
||
<script src="./build/app.js"></script> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var React = require('react'); | ||
var ReactDOM = require('react-dom'); | ||
import Sample from './Content/components/Sample.jsx'; | ||
ReactDOM.render( | ||
<Sample />, | ||
document.getElementById('root') | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file is just for the dev build too. You'd swap 'Sample' out for the component you were developing. you'd pass in any test data as props here for rendering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every component can be rendered on the server at its own route. This is the index route but in practise you'd use as a specific route for own componenet obviously