@@ -3,30 +3,20 @@ import path from 'path';
33import http from 'http' ;
44import ecstatic from 'ecstatic' ;
55import open from 'open' ;
6- import webpack from 'webpack' ;
76import minimist from 'minimist' ;
87
98import constants from '../../tasks/util/constants.js' ;
10- import config from '../../webpack.config.js' ;
119import { context } from 'esbuild' ;
12- import esbConfig from '../../esbuild-config.mjs' ;
13-
14- config . optimization = { minimize : false } ;
10+ import config from '../../esbuild-config.mjs' ;
1511
1612var args = minimist ( process . argv . slice ( 2 ) , { } ) ;
1713var PORT = args . port || 3000 ;
1814var strict = args . strict ;
1915var mathjax3 = args . mathjax3 ;
2016var mathjax3chtml = args . mathjax3chtml ;
21- var esbuild = args . esbuild ;
2217
2318if ( 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
3222var 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
10335function devServer ( ) {
10436 var server = http . createServer ( ecstatic ( {
0 commit comments