mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Improve demo webpack build
This commit is contained in:
+1
-1
@@ -33,6 +33,6 @@
|
||||
<hr/>
|
||||
<p><strong>Attention:</strong> The demo is a barebones implementation and is designed for the development and evaluation of xterm.js only. Exposing the demo to the public as is would introduce security risks for the host.</p>
|
||||
<button id="dispose" title="This is used to testing memory leaks">Dispose terminal</button>
|
||||
<script src="dist/bundle.js" defer ></script>
|
||||
<script src="dist/client-bundle.js" defer ></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -17,12 +17,8 @@ app.get('/style.css', function(req, res){
|
||||
res.sendFile(__dirname + '/style.css');
|
||||
});
|
||||
|
||||
app.get('/dist/bundle.js', function(req, res){
|
||||
res.sendFile(__dirname + '/dist/bundle.js');
|
||||
});
|
||||
|
||||
app.get('/dist/bundle.js.map', function(req, res){
|
||||
res.sendFile(__dirname + '/dist/bundle.js.map');
|
||||
app.get('/dist/client-bundle.js', function(req, res){
|
||||
res.sendFile(__dirname + '/dist/client-bundle.js');
|
||||
});
|
||||
|
||||
app.post('/terminals', function (req, res) {
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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.js'),
|
||||
devtool: 'inline-source-map',
|
||||
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
|
||||
}));
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"rootDir": ".",
|
||||
"sourceMap": true
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user