This commit is contained in:
2020-02-08 13:37:13 +03:00
commit 672e09abb5
21 changed files with 650 additions and 0 deletions

9
stubs/importmap.json Normal file
View File

@@ -0,0 +1,9 @@
{
"imports": {
"react": "/extlib/react/react.production.min.js",
"react-dom": "/extlib/react-dom/react-dom.production.min.js",
"redux": "/extlib/redux/redux.min.js",
"react-redux": "/extlib/react-redux/react-redux.min.js",
"styled-components": "extlib/styled-components/styled-components.min.js"
}
}

26
stubs/index.html Normal file
View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link
href="https://fonts.googleapis.com/css?family=Montserrat:400,600,700,900&amp;subset=cyrillic,cyrillic-ext"
rel="stylesheet"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Занятие по загрузчику</title>
<script type="systemjs-importmap" src="/importmap.json"></script>
<script src="extlib/systemjs/system.js"></script>
<script src="extlib/systemjs/extras/amd.js"></script>
<script src="extlib/systemjs/extras/named-register.js"></script>
<script src="extlib/systemjs/extras/named-exports.js"></script>
<script src="extlib/systemjs/extras/transform.js"></script>
</head>
<body>
<script type="text/javascript">
System.import('./bootstrap.js');
</script>
<div id="bootstrap"></div>
<div id="app"></div>
</body>
</html>

10
stubs/index.js Normal file
View File

@@ -0,0 +1,10 @@
const express = require("express");
const app = express();
app.use(express.static(__dirname + "/dist"));
app.listen(8090, () => console.log("Listening on port 8090!"));
module.exports = app;

17
stubs/server.js Normal file
View File

@@ -0,0 +1,17 @@
const hotClient = require('webpack-hot-client');
const middleware = require('webpack-dev-middleware');
const webpack = require('webpack');
const config = require('../webpack.config');
const app = require('../stubs');
const compiler = webpack(config);
const { publicPath } = config.output;
const options = { }; // webpack-hot-client options
// we recommend calling the client _before_ adding the dev middleware
const client = hotClient(compiler, options);
const { server } = client;
server.on('listening', () => {
app.use(middleware(compiler, { publicPath, historyApiFallback: true }));
});