Fix webpack headless

This commit is contained in:
Daniel Imms
2021-07-22 15:57:21 -07:00
parent 7117951233
commit 9b2e511bcb
4 changed files with 45 additions and 3 deletions
+1
View File
@@ -2,6 +2,7 @@ node_modules/
*.swp
.lock-wscript
lib/
lib-headless/
out/
out-test/
.nyc_output/
+2 -2
View File
@@ -2,8 +2,8 @@ Cursory test that 'xterm-core' works:
```
# From root of this repo
npm run compile # Outputs to xterm-core
npx webpack --config webpack.config.core.js # Outputs to lib
npm run compile # Outputs to out/headless
npx webpack --config webpack.config.headless.js # Outputs to lib
cd node-test
npm link ../lib/
node index.js
+1 -1
View File
@@ -5,7 +5,7 @@
"es2015",
"es2016.Array.Include"
],
"outDir": "../../out/headless", // Temporary outdir to avoid collisions with 'xterm'
"outDir": "../../out",
"types": [
"../../node_modules/@types/mocha",
"../../node_modules/@types/node"
+41
View File
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
const path = require('path');
/**
* This webpack config does a production build for xterm.js. It works by taking the output from tsc
* (via `yarn watch` or `yarn prebuild`) which are put into `out/` and webpacks them into a
* production mode umd library module in `lib/`. The aliases are used fix up the absolute paths
* output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`.
*/
module.exports = {
entry: './out/headless/public/Terminal.js',
devtool: 'source-map',
module: {
rules: [
{
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre",
exclude: /node_modules/
}
]
},
resolve: {
modules: ['./node_modules'],
extensions: [ '.js' ],
alias: {
common: path.resolve('./out/common'),
headless: path.resolve('./out/headless')
}
},
output: {
filename: 'xterm.js',
path: path.resolve('./lib-headless'),
libraryTarget: 'umd'
},
mode: 'production'
};