Skip to content

Commit 63d3de8

Browse files
committed
drop webpack from devtools/test_dashboard/server.mjs
1 parent ab7abd5 commit 63d3de8

File tree

1 file changed

+6
-74
lines changed

1 file changed

+6
-74
lines changed

devtools/test_dashboard/server.mjs

Lines changed: 6 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,20 @@ import path from 'path';
33
import http from 'http';
44
import ecstatic from 'ecstatic';
55
import open from 'open';
6-
import webpack from 'webpack';
76
import minimist from 'minimist';
87

98
import constants from '../../tasks/util/constants.js';
10-
import config from '../../webpack.config.js';
119
import { context } from 'esbuild';
12-
import esbConfig from '../../esbuild-config.mjs';
13-
14-
config.optimization = { minimize: false };
10+
import config from '../../esbuild-config.mjs';
1511

1612
var args = minimist(process.argv.slice(2), {});
1713
var PORT = args.port || 3000;
1814
var strict = args.strict;
1915
var mathjax3 = args.mathjax3;
2016
var mathjax3chtml = args.mathjax3chtml;
21-
var esbuild = args.esbuild;
2217

2318
if(strict) {
24-
config.entry = './lib/index-strict.js';
25-
esbConfig.entryPoints = ['./lib/index-strict.js'];
26-
}
27-
else {
28-
config.mode = 'development';
29-
config.devtool = 'eval';
19+
config.entryPoints = ['./lib/index-strict.js'];
3020
}
3121

3222
var mockFolder = constants.pathToTestImageMocks;
@@ -37,68 +27,10 @@ getMockFiles()
3727
.then(createMocksList)
3828
.then(saveMockListToFile);
3929

40-
// Devtools config
41-
var devtoolsConfig = {};
42-
43-
var devtoolsPath = path.join(constants.pathToRoot, 'devtools/test_dashboard');
44-
devtoolsConfig.entry = path.join(devtoolsPath, 'devtools.js');
45-
46-
devtoolsConfig.output = {
47-
path: config.output.path,
48-
filename: 'test_dashboard-bundle.js',
49-
library: {
50-
name: 'Tabs',
51-
type: 'umd'
52-
}
53-
};
54-
55-
devtoolsConfig.target = config.target;
56-
devtoolsConfig.plugins = config.plugins;
57-
devtoolsConfig.optimization = config.optimization;
58-
devtoolsConfig.mode = config.mode;
59-
60-
if(esbuild) {
61-
var ctx = await context(esbConfig);
62-
devServer();
63-
console.log('watching esbuild...');
64-
await ctx.watch();
65-
}
66-
else {
67-
var compiler;
68-
69-
compiler = webpack(devtoolsConfig);
70-
compiler.run(function(devtoolsErr, devtoolsStats) {
71-
if(devtoolsErr) {
72-
console.log('err:', devtoolsErr);
73-
} else if(devtoolsStats.errors && devtoolsStats.errors.length) {
74-
console.log('stats.errors:', devtoolsStats.errors);
75-
} else {
76-
console.log('success:', devtoolsConfig.output.path + '/' + devtoolsConfig.output.filename);
77-
}
78-
79-
compiler.close(function(closeErr) {
80-
if(!closeErr) {
81-
var firstBundle = true;
82-
83-
compiler = webpack(config);
84-
compiler.watch({}, function(err, stats) {
85-
if(err) {
86-
console.log('err:', err);
87-
} else if(stats.errors && stats.errors.length) {
88-
console.log('stats.errors:', stats.errors);
89-
} else {
90-
console.log('success:', config.output.path + '/' + config.output.filename);
91-
92-
if(firstBundle) {
93-
devServer();
94-
firstBundle = false;
95-
}
96-
}
97-
});
98-
}
99-
});
100-
});
101-
}
30+
var ctx = await context(config);
31+
devServer();
32+
console.log('watching esbuild...');
33+
await ctx.watch();
10234

10335
function devServer() {
10436
var server = http.createServer(ecstatic({

0 commit comments

Comments
 (0)