50 lines
1.0 KiB
JavaScript
50 lines
1.0 KiB
JavaScript
/**
|
|
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
|
* @license MIT
|
|
*
|
|
* This file is the entry point for browserify.
|
|
*/
|
|
|
|
const cp = require('child_process');
|
|
const path = require('path');
|
|
const webpack = require('webpack');
|
|
|
|
// Launch server
|
|
cp.spawn('node', [path.resolve(__dirname, 'server.js')], { stdio: 'inherit' });
|
|
|
|
// Build/watch client source
|
|
const clientConfig = {
|
|
entry: path.resolve(__dirname, 'client.ts'),
|
|
devtool: 'inline-source-map',
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/
|
|
}
|
|
]
|
|
},
|
|
resolve: {
|
|
extensions: [ '.tsx', '.ts', '.js' ]
|
|
},
|
|
output: {
|
|
filename: 'client-bundle.js',
|
|
path: path.resolve(__dirname, 'dist')
|
|
},
|
|
mode: 'development',
|
|
watch: true
|
|
};
|
|
const compiler = webpack(clientConfig);
|
|
|
|
compiler.watch({
|
|
// Example watchOptions
|
|
aggregateTimeout: 300,
|
|
poll: undefined
|
|
}, (err, stats) => {
|
|
// Print watch/build result here...
|
|
console.log(stats.toString({
|
|
colors: true
|
|
}));
|
|
});
|