Fix demo build script
This commit is contained in:
+1
-58
@@ -5,69 +5,12 @@
|
|||||||
|
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
const path = require('path');
|
const clientConfig = require('./webpack.config');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const startServer = require('./server.js');
|
const startServer = require('./server.js');
|
||||||
|
|
||||||
startServer();
|
startServer();
|
||||||
|
|
||||||
/**
|
|
||||||
* This webpack config builds and watches the demo project. It works by taking the output from tsc
|
|
||||||
* (via `yarn watch`) which is put into `out/` and then webpacks it into `demo/dist/`. The aliases
|
|
||||||
* are used fix up the absolute paths output by tsc (because of `baseUrl` and `paths` in
|
|
||||||
* `tsconfig.json`.
|
|
||||||
*
|
|
||||||
* For production builds see `webpack.config.js` in the root directory. If that is built the demo
|
|
||||||
* can use that by switching out which `Terminal` is imported in `client.ts`, this is useful for
|
|
||||||
* validating that the packaged version works correctly.
|
|
||||||
*
|
|
||||||
* @type {import('webpack').Configuration}
|
|
||||||
*/
|
|
||||||
const clientConfig = {
|
|
||||||
entry: path.resolve(__dirname, 'client.ts'),
|
|
||||||
devtool: 'inline-source-map',
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.tsx?$/,
|
|
||||||
use: 'ts-loader',
|
|
||||||
exclude: /node_modules/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
use: ["source-map-loader"],
|
|
||||||
enforce: "pre",
|
|
||||||
exclude: /node_modules/
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
modules: [
|
|
||||||
'node_modules',
|
|
||||||
path.resolve(__dirname, '..'),
|
|
||||||
path.resolve(__dirname, '../addons')
|
|
||||||
],
|
|
||||||
extensions: [ '.tsx', '.ts', '.js' ],
|
|
||||||
alias: {
|
|
||||||
common: path.resolve('./out/common'),
|
|
||||||
browser: path.resolve('./out/browser')
|
|
||||||
},
|
|
||||||
fallback: {
|
|
||||||
// The ligature modules contains fallbacks for node environments, we never want to browserify them
|
|
||||||
stream: false,
|
|
||||||
util: false,
|
|
||||||
os: false,
|
|
||||||
path: false,
|
|
||||||
fs: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: 'client-bundle.js',
|
|
||||||
path: path.resolve(__dirname, 'dist')
|
|
||||||
},
|
|
||||||
mode: 'development',
|
|
||||||
watch: true
|
|
||||||
};
|
|
||||||
const compiler = webpack(clientConfig);
|
const compiler = webpack(clientConfig);
|
||||||
|
|
||||||
compiler.watch({
|
compiler.watch({
|
||||||
|
|||||||
@@ -1,26 +1,21 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This webpack config builds and watches the demo project. It works by taking the output from tsc
|
* This webpack config does a production build for xterm.js. It works by taking the output from tsc
|
||||||
* (via `yarn watch`) which is put into `out/` and then webpacks it into `demo/dist/`. The aliases
|
* (via `yarn watch` or `yarn prebuild`) which are put into `out/` and webpacks them into a
|
||||||
* are used fix up the absolute paths output by tsc (because of `baseUrl` and `paths` in
|
* production mode umd library module in `lib/`. The aliases are used fix up the absolute paths
|
||||||
* `tsconfig.json`.
|
* output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`.
|
||||||
*
|
|
||||||
* For production builds see `webpack.config.js` in the root directory. If that is built the demo
|
|
||||||
* can use that by switching out which `Terminal` is imported in `client.ts`, this is useful for
|
|
||||||
* validating that the packaged version works correctly.
|
|
||||||
*
|
*
|
||||||
* @type {import('webpack').Configuration}
|
* @type {import('webpack').Configuration}
|
||||||
*/
|
*/
|
||||||
const clientConfig = {
|
const config = {
|
||||||
entry: path.resolve(__dirname, 'client.ts'),
|
entry: path.resolve(__dirname, 'client.ts'),
|
||||||
devtool: 'inline-source-map',
|
devtool: 'inline-source-map',
|
||||||
module: {
|
module: {
|
||||||
@@ -62,16 +57,6 @@ const clientConfig = {
|
|||||||
filename: 'client-bundle.js',
|
filename: 'client-bundle.js',
|
||||||
path: path.resolve(__dirname, 'dist')
|
path: path.resolve(__dirname, 'dist')
|
||||||
},
|
},
|
||||||
mode: 'development',
|
mode: 'development'
|
||||||
watch: true
|
|
||||||
};
|
};
|
||||||
const compiler = webpack(clientConfig);
|
module.exports = config;
|
||||||
|
|
||||||
compiler.compile(() => (err, stats) => {
|
|
||||||
if (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
console.log(stats?.toString({
|
|
||||||
colors: true
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
"package-headless": "webpack --config ./webpack.config.headless.js",
|
"package-headless": "webpack --config ./webpack.config.headless.js",
|
||||||
"postpackage-headless": "node ./bin/package_headless.js",
|
"postpackage-headless": "node ./bin/package_headless.js",
|
||||||
"start": "node demo/start",
|
"start": "node demo/start",
|
||||||
"build-demo": "node demo/build",
|
"build-demo": "webpack --config ./demo/webpack.config.js",
|
||||||
"start-debug": "node --inspect-brk demo/start",
|
"start-debug": "node --inspect-brk demo/start",
|
||||||
"lint": "eslint -c .eslintrc.json --max-warnings 0 --ext .ts src/ addons/",
|
"lint": "eslint -c .eslintrc.json --max-warnings 0 --ext .ts src/ addons/",
|
||||||
"lint-api": "eslint --no-eslintrc -c .eslintrc.json.typings --max-warnings 0 --no-ignore --ext .d.ts typings/",
|
"lint-api": "eslint --no-eslintrc -c .eslintrc.json.typings --max-warnings 0 --no-ignore --ext .d.ts typings/",
|
||||||
|
|||||||
Reference in New Issue
Block a user