orc-scripts 2.0.0-dev.2 → 2.0.0-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orc-scripts",
3
- "version": "2.0.0-dev.2",
3
+ "version": "2.0.0-dev.4",
4
4
  "description": "Scripts toolbox for Orckestra",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -93,8 +93,10 @@ if (parseEnv("NODE_ENV") === "production") {
93
93
  usedExports: true,
94
94
  moduleIds: 'named',
95
95
  };
96
- config.plugins.push(new webpack.HotModuleReplacementPlugin());
97
96
  config.mode = "development";
97
+ config.snapshot = {
98
+ managedPaths: [],
99
+ };
98
100
  }
99
101
 
100
102
  module.exports = config;
@@ -1,4 +1,4 @@
1
- const webpackDevServer = require("webpack-dev-server");
1
+ const DevServer = require("webpack-dev-server");
2
2
  const webpack = require("webpack");
3
3
 
4
4
  const HOST = process.env.HOSTNAME || "localhost";
@@ -9,37 +9,27 @@ const PORT = argPort || process.env.PORT || 5000;
9
9
 
10
10
  const config = require("../config/webpack.config.js");
11
11
  const options = {
12
- contentBase: "./dist",
13
- publicPath: process.env.WEBPACK_PUBLIC_PATH || "/",
14
12
  historyApiFallback: true,
15
- hotOnly: true,
13
+ hot: "only",
16
14
  port: PORT,
17
15
  host: HOST,
16
+ static: './dist',
17
+ devMiddleware: {
18
+ publicPath: process.env.WEBPACK_PUBLIC_PATH || "/",
19
+ },
18
20
  };
19
21
 
20
22
  if (HOST !== "localhost") {
21
23
  options.public = HOST;
22
24
  }
23
25
  if (HOST !== "localhost" || args.indexOf("--https") !== -1 || process.env.HTTPS) {
24
- options.https = true;
26
+ options.server = 'https';
25
27
  }
26
28
 
27
- const location = "http" + (options.https ? "s" : "") + "://" + HOST + ":" + PORT;
28
-
29
- // /mockData/ contains json files to simulate API endpoints
30
- options.before = (app, server) => {
31
- app.get("/mockData/*", (req, res, next) => {
32
- const parsedUrl = new URL(req.url, location);
33
- parsedUrl.pathname = parsedUrl.pathname + ".json";
34
- req.url = parsedUrl.href.replace(location, "");
35
- next();
36
- });
37
- };
38
-
39
- webpackDevServer.addDevServerEntrypoints(config, options);
40
29
  const compiler = webpack(config);
41
- const server = new webpackDevServer(compiler, options);
42
30
 
43
- server.listen(PORT, "localhost", () => {
44
- console.log("dev server listening at " + location);
45
- });
31
+ const server = new DevServer(options, compiler);
32
+
33
+ (async () => {
34
+ await server.start();
35
+ })();